From: myoungwon oh Date: Fri, 3 Jul 2020 15:02:25 +0000 (+0900) Subject: osd: clear redirect after promote X-Git-Tag: v16.1.0~1248^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=02bc60c9533e0bf03dfb01da801895c25c41d3e0;p=ceph.git osd: clear redirect after promote 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 793d57d93a23..3dc68ba3f1e8 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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);