From: Mykola Golub Date: Sat, 30 May 2020 08:44:17 +0000 (+0100) Subject: librbd: send unquiesce even if quiesce failed X-Git-Tag: v16.1.0~2015^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b2b0aca970beac09e00bd84d90b5694be4ed4a62;p=ceph.git librbd: send unquiesce even if quiesce failed 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 --- diff --git a/src/librbd/operation/SnapshotCreateRequest.cc b/src/librbd/operation/SnapshotCreateRequest.cc index 5966095caea2..15d8e2f7a285 100644 --- a/src/librbd/operation/SnapshotCreateRequest.cc +++ b/src/librbd/operation/SnapshotCreateRequest.cc @@ -79,7 +79,9 @@ Context *SnapshotCreateRequest::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::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::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); diff --git a/src/librbd/operation/SnapshotCreateRequest.h b/src/librbd/operation/SnapshotCreateRequest.h index db653817e7f8..20e591e71be2 100644 --- a/src/librbd/operation/SnapshotCreateRequest.h +++ b/src/librbd/operation/SnapshotCreateRequest.h @@ -29,12 +29,12 @@ public: * * | * 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; diff --git a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc index f43b39f36014..e2032a084054 100644 --- a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc +++ b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc @@ -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;