]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: make rename be always executed by lock owner
authorMykola Golub <mgolub@suse.com>
Sun, 14 Feb 2021 11:50:32 +0000 (11:50 +0000)
committerMykola Golub <mgolub@suse.com>
Fri, 5 Mar 2021 16:53:19 +0000 (18:53 +0200)
Fixes: https://tracker.ceph.com/issues/49115
Signed-off-by: Mykola Golub <mgolub@suse.com>
(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")

src/librbd/Operations.cc

index 9329786d6df0c2dcfb58b05440fec6731f6bdec3..95998db651946d9793789dbca008feee776a9adc 100644 (file)
@@ -537,29 +537,16 @@ int Operations<I>::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<I>::execute_rename, this,
-                                         dstname, _1),
-                             boost::bind(&ImageWatcher<I>::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<I>::execute_rename, this,
+                                       dstname, _1),
+                           boost::bind(&ImageWatcher<I>::notify_rename,
+                                       m_image_ctx.image_watcher, dstname,
+                                       _1));
+  if (r < 0 && r != -EEXIST) {
+    return r;
   }
 
   m_image_ctx.set_image_name(dstname);