From: Zengran Zhang Date: Mon, 25 Mar 2019 08:54:54 +0000 (+0800) Subject: osd: process_copy_chunk remove obc ref before pg unlock X-Git-Tag: v14.2.1~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d85d9a9eab852936bcde89c4c48fd8f83d67170d;p=ceph.git osd: process_copy_chunk remove obc ref before pg unlock drop the obc ref when pg locked is more safer, if not, on_change may failed to clear it, and on_flushed may find leak. Fixes: http://tracker.ceph.com/issues/38842 Signed-off-by: Kefu Chai kchai@redhat.com Signed-off-by: Zengran Zhang (cherry picked from commit 70874399da47411e1e07824ef50dd82c4ebb6922) --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 8d83d81d0543..66017e9b7f5e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -8687,7 +8687,7 @@ struct C_Copyfrom : public Context { hobject_t oid; epoch_t last_peering_reset; ceph_tid_t tid; - PrimaryLogPG::CopyOpRef cop; + PrimaryLogPG::CopyOpRef cop; // used for keeping the cop alive C_Copyfrom(PrimaryLogPG *p, hobject_t o, epoch_t lpr, const PrimaryLogPG::CopyOpRef& c) : pg(p), oid(o), last_peering_reset(lpr), @@ -8699,6 +8699,7 @@ struct C_Copyfrom : public Context { pg->lock(); if (last_peering_reset == pg->get_last_peering_reset()) { pg->process_copy_chunk(oid, tid, r); + cop.reset(); } pg->unlock(); } @@ -8731,7 +8732,7 @@ struct C_CopyChunk : public Context { hobject_t oid; epoch_t last_peering_reset; ceph_tid_t tid; - PrimaryLogPG::CopyOpRef cop; + PrimaryLogPG::CopyOpRef cop; // used for keeping the cop alive uint64_t offset = 0; C_CopyChunk(PrimaryLogPG *p, hobject_t o, epoch_t lpr, const PrimaryLogPG::CopyOpRef& c) @@ -8744,6 +8745,7 @@ struct C_CopyChunk : public Context { pg->lock(); if (last_peering_reset == pg->get_last_peering_reset()) { pg->process_copy_chunk_manifest(oid, tid, r, offset); + cop.reset(); } pg->unlock(); }