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: v10.2.4~61^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4baea6ace14bd834a3cb2c1d9d5202e94546e264;p=ceph.git librbd: block RPC requests when demoting the image Signed-off-by: Jason Dillaman (cherry picked from commit 8b195e1fc8fe70a0e5417934302d5831b1f8dfb3) --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index a999f6f79b0..406c2caa33d 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2944,6 +2944,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);