From: Mykola Golub Date: Sun, 14 Feb 2021 11:50:32 +0000 (+0000) Subject: librbd: make rename be always executed by lock owner X-Git-Tag: v15.2.10~12^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=efd13d1aa29456acdf6c255cf277b3671f011cde;p=ceph.git librbd: make rename be always executed by lock owner Fixes: https://tracker.ceph.com/issues/49115 Signed-off-by: Mykola Golub (cherry picked from commit 2a9fac2cc4b10af04c52e12f34932e6d2d91441f) Conflicts: src/librbd/Operations.cc (request_id (async notification) is not used for "rename" op in octopus -- added in pasific for "serialize maintenance operations by type") --- diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index 9329786d6df..95998db6519 100644 --- a/src/librbd/Operations.cc +++ b/src/librbd/Operations.cc @@ -537,29 +537,16 @@ int Operations::rename(const char *dstname) { return -EEXIST; } - if (m_image_ctx.test_features(RBD_FEATURE_JOURNALING)) { - r = invoke_async_request("rename", - exclusive_lock::OPERATION_REQUEST_TYPE_GENERAL, - true, - boost::bind(&Operations::execute_rename, this, - dstname, _1), - boost::bind(&ImageWatcher::notify_rename, - m_image_ctx.image_watcher, dstname, - _1)); - if (r < 0 && r != -EEXIST) { - return r; - } - } else { - C_SaferCond cond_ctx; - { - std::shared_lock owner_lock{m_image_ctx.owner_lock}; - execute_rename(dstname, &cond_ctx); - } - - r = cond_ctx.wait(); - if (r < 0) { - return r; - } + r = invoke_async_request("rename", + exclusive_lock::OPERATION_REQUEST_TYPE_GENERAL, + true, + boost::bind(&Operations::execute_rename, this, + dstname, _1), + boost::bind(&ImageWatcher::notify_rename, + m_image_ctx.image_watcher, dstname, + _1)); + if (r < 0 && r != -EEXIST) { + return r; } m_image_ctx.set_image_name(dstname);