From: Jason Dillaman Date: Thu, 11 Aug 2016 23:09:09 +0000 (-0400) Subject: librbd: block RPC requests when demoting the image X-Git-Tag: ses5-milestone5~100^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b195e1fc8fe70a0e5417934302d5831b1f8dfb3;p=ceph.git librbd: block RPC requests when demoting the image Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 13b70efb9c7..8176339a2fe 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -3106,6 +3106,15 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force, return -EINVAL; } + // avoid accepting new requests from peers while we demote + // the image + ictx->exclusive_lock->block_requests(0); + BOOST_SCOPE_EXIT_ALL( (ictx) ) { + if (ictx->exclusive_lock != nullptr) { + ictx->exclusive_lock->unblock_requests(); + } + }; + C_SaferCond lock_ctx; ictx->exclusive_lock->request_lock(&lock_ctx);