]> 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, 11 Oct 2016 16:44:13 +0000 (12:44 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 8b195e1fc8fe70a0e5417934302d5831b1f8dfb3)

src/librbd/internal.cc

index a999f6f79b0d178018e9d8f50e5f6cdea0b7a243..406c2caa33d9bcd0c20bfa189a6938f5fcd17f61 100644 (file)
@@ -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);