From 65c99a4f3efd197e3ce8e91605903609b01ab0d2 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Wed, 8 Jul 2020 15:15:31 +0900 Subject: [PATCH] osd: fix reference leak ctx will be moved, so replace it with the value Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 58f3ca3fe1aff..92ce9516d608d 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3515,9 +3515,12 @@ void PrimaryLogPG::dec_all_refcount_manifest(const object_info_t& oi, OpContext* refs); if (!refs.is_empty()) { + hobject_t soid = ctx->obc->obs.oi.soid; ctx->register_on_commit( - [ctx, this, refs](){ - dec_refcount(ctx->obc, refs); + [soid, this, refs](){ + ObjectContextRef obc = get_object_context(soid, false, NULL); + ceph_assert(obc); + dec_refcount(obc, refs); }); } } else if (oi.manifest.is_redirect()) {