From: myoungwon oh Date: Sat, 20 Feb 2021 14:02:55 +0000 (+0900) Subject: osd: fix to call correct ObjectContext X-Git-Tag: v17.1.0~2307^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=170b30e35eb0ff61a026cfba3eee0c713a77bac4;p=ceph.git osd: fix to call correct ObjectContext During trim_object(), oid from oi differs with oid from ctx in dec_all_refcount(). To avoid this, use oi's oid when retreiving objectcontext. Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index d84a605e142..d155fae1b2e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3600,14 +3600,18 @@ void PrimaryLogPG::dec_all_refcount_manifest(const object_info_t& oi, OpContext* if (oi.manifest.is_chunked()) { object_ref_delta_t refs; - ObjectContextRef obc_l, obc_g; - get_adjacent_clones(ctx->obc, obc_l, obc_g); + ObjectContextRef obc_l, obc_g, obc; + /* in trim_object, oi and ctx can have different oid */ + obc = get_object_context(oi.soid, false, NULL); + ceph_assert(obc); + get_adjacent_clones(obc, obc_l, obc_g); oi.manifest.calc_refs_to_drop_on_removal( obc_l ? &(obc_l->obs.oi.manifest) : nullptr, obc_g ? &(obc_g->obs.oi.manifest) : nullptr, refs); if (!refs.is_empty()) { + /* dec_refcount will use head object anyway */ hobject_t soid = ctx->obc->obs.oi.soid; ctx->register_on_commit( [soid, this, refs](){ @@ -8127,11 +8131,6 @@ inline int PrimaryLogPG::_delete_oid( } oi.watchers.clear(); - if (oi.has_manifest()) { - ctx->delta_stats.num_objects_manifest--; - dec_all_refcount_manifest(oi, ctx); - } - if (whiteout) { dout(20) << __func__ << " setting whiteout on " << soid << dendl; oi.set_flag(object_info_t::FLAG_WHITEOUT); @@ -8141,6 +8140,11 @@ inline int PrimaryLogPG::_delete_oid( return 0; } + if (oi.has_manifest()) { + ctx->delta_stats.num_objects_manifest--; + dec_all_refcount_manifest(oi, ctx); + } + // delete the head ctx->delta_stats.num_objects--; if (soid.is_snap())