From 9d6fc30e54f4c0ecfac4e9a907d818e1e7665b96 Mon Sep 17 00:00:00 2001 From: Mykola Golub <mgolub@suse.com> Date: Wed, 21 Feb 2018 10:45:57 +0200 Subject: [PATCH 1/2] librbd: make rename request complete with filtered code Fixes: http://tracker.ceph.com/issues/23068 Signed-off-by: Mykola Golub <mgolub@suse.com> --- src/librbd/operation/RenameRequest.cc | 4 ++-- src/librbd/operation/RenameRequest.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librbd/operation/RenameRequest.cc b/src/librbd/operation/RenameRequest.cc index a4dbf1e5235..1e837472948 100644 --- a/src/librbd/operation/RenameRequest.cc +++ b/src/librbd/operation/RenameRequest.cc @@ -64,7 +64,7 @@ bool RenameRequest<I>::should_complete(int r) { CephContext *cct = image_ctx.cct; ldout(cct, 5) << this << " " << __func__ << ": state=" << m_state << ", " << "r=" << r << dendl; - r = filter_state_return_code(r); + r = filter_return_code(r); if (r < 0) { if (r == -EEXIST) { ldout(cct, 1) << "image already exists" << dendl; @@ -100,7 +100,7 @@ bool RenameRequest<I>::should_complete(int r) { } template <typename I> -int RenameRequest<I>::filter_state_return_code(int r) { +int RenameRequest<I>::filter_return_code(int r) const { I &image_ctx = this->m_image_ctx; CephContext *cct = image_ctx.cct; diff --git a/src/librbd/operation/RenameRequest.h b/src/librbd/operation/RenameRequest.h index 46a8dbcdfee..6534d36c098 100644 --- a/src/librbd/operation/RenameRequest.h +++ b/src/librbd/operation/RenameRequest.h @@ -57,6 +57,7 @@ public: protected: void send_op() override; bool should_complete(int r) override; + int filter_return_code(int r) const override; journal::Event create_event(uint64_t op_tid) const override { return journal::RenameEvent(op_tid, m_dest_name); @@ -72,8 +73,6 @@ private: bufferlist m_header_bl; - int filter_state_return_code(int r); - void send_read_source_header(); void send_write_destination_header(); void send_update_directory(); From 56e762b13aae302e6ab3cddb43f277d13ba6f43c Mon Sep 17 00:00:00 2001 From: Mykola Golub <mgolub@suse.com> Date: Wed, 21 Feb 2018 10:46:21 +0200 Subject: [PATCH 2/2] test/librbd: fix required features for ViaLockOwner tests The rename operation is RPCed only when journaling is enabled. The snap_remove operation is RPCed only when either fast-diff or journaling is enabled. The rename, snap_create, and snap_remove do not require layering. Signed-off-by: Mykola Golub <mgolub@suse.com> --- src/test/librbd/test_librbd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 574bf2724f5..addf74563cf 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -4555,7 +4555,7 @@ TEST_F(TestLibRBD, RebuildObjectMapViaLockOwner) TEST_F(TestLibRBD, RenameViaLockOwner) { - REQUIRE_FEATURE(RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK); + REQUIRE_FEATURE(RBD_FEATURE_JOURNALING); librados::IoCtx ioctx; ASSERT_EQ(0, _rados.ioctx_create(m_pool_name.c_str(), ioctx)); @@ -4587,7 +4587,7 @@ TEST_F(TestLibRBD, RenameViaLockOwner) TEST_F(TestLibRBD, SnapCreateViaLockOwner) { - REQUIRE_FEATURE(RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK); + REQUIRE_FEATURE(RBD_FEATURE_EXCLUSIVE_LOCK); librados::IoCtx ioctx; ASSERT_EQ(0, _rados.ioctx_create(m_pool_name.c_str(), ioctx)); @@ -4631,7 +4631,7 @@ TEST_F(TestLibRBD, SnapCreateViaLockOwner) TEST_F(TestLibRBD, SnapRemoveViaLockOwner) { - REQUIRE_FEATURE(RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK); + REQUIRE_FEATURE(RBD_FEATURE_FAST_DIFF); librados::IoCtx ioctx; ASSERT_EQ(0, _rados.ioctx_create(m_pool_name.c_str(), ioctx));