]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix to call correct ObjectContext
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 20 Feb 2021 14:02:55 +0000 (23:02 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Mon, 29 Mar 2021 08:15:43 +0000 (17:15 +0900)
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 <myoungwon.oh@samsung.com>
src/osd/PrimaryLogPG.cc

index d84a605e14242e9f0e90ed3a0274afdc46913dbb..d155fae1b2e6d520b667c8fc2943d28de6217928 100644 (file)
@@ -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())