]> 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>
Sun, 14 Feb 2021 11:53:00 +0000 (11:53 +0000)
Fixes: https://tracker.ceph.com/issues/49115
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/Operations.cc

index 2c06df6a034b0906987a38a4c4c7b03f54a91c64..30bb7efb3a6b4823625107b72768a81614a0f491 100644 (file)
@@ -671,30 +671,17 @@ int Operations<I>::rename(const char *dstname) {
     return -EEXIST;
   }
 
-  if (m_image_ctx.test_features(RBD_FEATURE_JOURNALING)) {
-    uint64_t request_id = util::reserve_async_request_id();
-    r = invoke_async_request(OPERATION_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, request_id,
-                                         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;
-    }
+  uint64_t request_id = util::reserve_async_request_id();
+  r = invoke_async_request(OPERATION_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, request_id,
+                                       dstname, _1));
+  if (r < 0 && r != -EEXIST) {
+    return r;
   }
 
   m_image_ctx.set_image_name(dstname);