]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: block RPC requests when demoting the image
authorJason Dillaman <dillaman@redhat.com>
Thu, 11 Aug 2016 23:09:09 +0000 (19:09 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 16 Aug 2016 13:11:07 +0000 (09:11 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/internal.cc

index 13b70efb9c75c7784e5c1444ec1fc9d406c693b4..8176339a2febf87d957ad317d81ed738145b9f58 100644 (file)
@@ -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);