From: Jason Dillaman Date: Tue, 30 May 2017 19:50:44 +0000 (-0400) Subject: librbd: new exclusive lock accept_replay helper method X-Git-Tag: ses5-milestone6~8^2~5^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=603f44a880fede9dd912f498387395ec13b00dd7;p=ceph.git librbd: new exclusive lock accept_replay helper method Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ExclusiveLock.cc b/src/librbd/ExclusiveLock.cc index 1688afca98cf..3b5f04189210 100644 --- a/src/librbd/ExclusiveLock.cc +++ b/src/librbd/ExclusiveLock.cc @@ -50,6 +50,18 @@ bool ExclusiveLock::accept_requests(int *ret_val) const { return accept_requests; } +template +bool ExclusiveLock::accept_ops() const { + Mutex::Locker locker(ML::m_lock); + bool accept_ops = (!ML::is_state_shutdown() && + !ML::is_state_pre_releasing() && + (ML::is_state_locked() || + ML::is_state_post_acquiring())); + + ldout(m_image_ctx.cct, 20) << "=" << accept_ops << dendl; + return accept_ops; +} + template void ExclusiveLock::block_requests(int r) { Mutex::Locker locker(ML::m_lock); diff --git a/src/librbd/ExclusiveLock.h b/src/librbd/ExclusiveLock.h index 3b2a756edc0a..102501f5fbfc 100644 --- a/src/librbd/ExclusiveLock.h +++ b/src/librbd/ExclusiveLock.h @@ -19,6 +19,7 @@ public: ExclusiveLock(ImageCtxT &image_ctx); bool accept_requests(int *ret_val = nullptr) const; + bool accept_ops() const; void block_requests(int r); void unblock_requests();