]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clear redirect after promote
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 3 Jul 2020 15:02:25 +0000 (00:02 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 13:07:10 +0000 (22:07 +0900)
We do want PROMOTE to be able to atomically replace
a redirect with the actual object, so the solution
is to clear the redirect at the end of the promote.

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/osd/PrimaryLogPG.cc

index 793d57d93a230a209be4bf68d7822e7dcad3f291..3dc68ba3f1e828d647fbea097a3aa7fe8da144d6 100644 (file)
@@ -9846,6 +9846,17 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results,
   tctx->extra_reqids = results->reqids;
   tctx->extra_reqid_return_codes = results->reqid_return_codes;
 
+  if (obc->obs.oi.has_manifest() && obc->obs.oi.manifest.is_redirect()) {
+    tctx->new_obs.oi.manifest.type = object_manifest_t::TYPE_NONE;
+    tctx->new_obs.oi.clear_flag(object_info_t::FLAG_REDIRECT_HAS_REFERENCE);
+    tctx->new_obs.oi.clear_flag(object_info_t::FLAG_MANIFEST);
+    tctx->new_obs.oi.manifest.redirect_target = hobject_t();
+    tctx->delta_stats.num_objects_manifest--;
+    if (obc->obs.oi.test_flag(object_info_t::FLAG_REDIRECT_HAS_REFERENCE)) {
+      dec_all_refcount_manifest(obc->obs.oi, tctx.get());
+    }
+  }
+
   if (whiteout) {
     // create a whiteout
     tctx->op_t->create(soid);