From: myoungwon oh Date: Sun, 30 Aug 2020 08:23:52 +0000 (+0900) Subject: osd: fix reference leak X-Git-Tag: wip-pdonnell-testing-20200918.022351~185^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ad7a2b8e9dd6bc55c56d296a8c6b079cebafa581;p=ceph-ci.git osd: fix reference leak Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 29ce96904a3..bc24519ab93 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3295,7 +3295,7 @@ void PrimaryLogPG::get_adjacent_clones(const object_info_t& oi, OpContext* ctx, } bool PrimaryLogPG::inc_refcount_by_set(OpContext* ctx, object_manifest_t& set_chunk, - RefCountCallback* fin) + OSDOp& osd_op) { object_ref_delta_t refs; ObjectContextRef obc_l, obc_g; @@ -3315,6 +3315,7 @@ bool PrimaryLogPG::inc_refcount_by_set(OpContext* ctx, object_manifest_t& set_ch * the reference the targe object has prior to update object_manifest in object_info_t. * So, call directly refcount_manifest. */ + RefCountCallback *fin = new RefCountCallback(ctx, osd_op); refcount_manifest(ctx->obs->oi.soid, p->first, refcount_t::INCREMENT_REF, fin); return true; @@ -3323,7 +3324,7 @@ bool PrimaryLogPG::inc_refcount_by_set(OpContext* ctx, object_manifest_t& set_ch hobject_t tgt = p->first; ctx->register_on_commit( [src, tgt, this](){ - refcount_manifest(src, tgt, refcount_t::DECREMENT_REF, NULL); + refcount_manifest(src, tgt, refcount_t::DECREMENT_REF, NULL); }); return false; } @@ -6906,11 +6907,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) // start ctx->op_finishers[ctx->current_osd_subop_num].reset( new SetManifestFinisher(osd_op)); - RefCountCallback *fin = new RefCountCallback(ctx, osd_op); object_manifest_t set_chunk; bool need_inc_ref = false; set_chunk.chunk_map[src_offset] = chunk_info; - need_inc_ref = inc_refcount_by_set(ctx, set_chunk, fin); + need_inc_ref = inc_refcount_by_set(ctx, set_chunk, osd_op); if (need_inc_ref) { result = -EINPROGRESS; break; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index f6f30bf0e05..5dcc1bc1bed 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1500,7 +1500,7 @@ protected: void get_adjacent_clones(const object_info_t& oi, OpContext* ctx, ObjectContextRef& _l, ObjectContextRef& _g); bool inc_refcount_by_set(OpContext* ctx, object_manifest_t& tgt, - RefCountCallback* fin = NULL); + OSDOp& osd_op); friend struct C_ProxyChunkRead; friend class PromoteManifestCallback;