]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: send unquiesce even if quiesce failed
authorMykola Golub <mgolub@suse.com>
Sat, 30 May 2020 08:44:17 +0000 (09:44 +0100)
committerMykola Golub <mgolub@suse.com>
Tue, 9 Jun 2020 07:33:51 +0000 (08:33 +0100)
If several clients are subscribed it may fail for only some of
them, thus tell the succeeded clients to unquiesce so they do not
wait for timeout.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/operation/SnapshotCreateRequest.cc
src/librbd/operation/SnapshotCreateRequest.h
src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc

index 5966095caea290319a9d07def38b46321b2c6e5e..15d8e2f7a2855eb348e8826b0358a0efb220db80 100644 (file)
@@ -79,7 +79,9 @@ Context *SnapshotCreateRequest<I>::handle_notify_quiesce(int *result) {
   if (*result < 0) {
     lderr(cct) << "failed to notify quiesce: " << cpp_strerror(*result)
                << dendl;
-    return this->create_context_finisher(*result);
+    save_result(result);
+    send_notify_unquiesce();
+    return nullptr;
   }
 
   std::shared_lock owner_locker{image_ctx.owner_lock};
@@ -133,6 +135,8 @@ Context *SnapshotCreateRequest<I>::handle_suspend_aio(int *result) {
     return send_notify_unquiesce();
   }
 
+  m_writes_blocked = true;
+
   send_append_op_event();
   return nullptr;
 }
@@ -357,7 +361,9 @@ Context *SnapshotCreateRequest<I>::send_notify_unquiesce() {
   CephContext *cct = image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << dendl;
 
-  image_ctx.io_image_dispatcher->unblock_writes();
+  if (m_writes_blocked) {
+    image_ctx.io_image_dispatcher->unblock_writes();
+  }
 
   if (m_skip_notify_quiesce) {
     return this->create_context_finisher(m_ret_val);
index db653817e7f81423b64acb9edc81542b602132fb..20e591e71be267318d4ac9f4ecea8a20831efbf4 100644 (file)
@@ -29,12 +29,12 @@ public:
    *            <start>
    *               |
    *               v
-   *           STATE_NOTIFY_QUIESCE
-   *               |
-   *               v
-   *           STATE_SUSPEND_REQUESTS
-   *               |
-   *               v
+   *           STATE_NOTIFY_QUIESCE  * * * * * * * * * * * * *
+   *               |                                         *
+   *               v                                         *
+   *           STATE_SUSPEND_REQUESTS                        *
+   *               |                                         *
+   *               v                                         *
    *           STATE_SUSPEND_AIO * * * * * * * * * * * * * * *
    *               |                                         *
    *               v                                         *
@@ -94,6 +94,7 @@ private:
 
   uint64_t m_request_id = 0;
   int m_ret_val = 0;
+  bool m_writes_blocked = false;
 
   uint64_t m_snap_id = CEPH_NOSNAP;
   uint64_t m_size;
index f43b39f36014be665c555d7cc735e46249325661..e2032a084054c1c5d13e48c408ba4b7ed09015aa 100644 (file)
@@ -206,6 +206,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, NotifyQuiesceError) {
 
   ::testing::InSequence seq;
   expect_notify_quiesce(mock_image_ctx, -EINVAL);
+  expect_notify_unquiesce(mock_image_ctx, 0);
 
   C_SaferCond cond_ctx;
   librbd::NoOpProgressContext prog_ctx;