]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: process_copy_chunk remove obc ref before pg unlock 27587/head
authorZengran Zhang <zhangzengran@sangfor.com.cn>
Mon, 25 Mar 2019 08:54:54 +0000 (16:54 +0800)
committerPrashant D <pdhange@redhat.com>
Mon, 15 Apr 2019 03:47:41 +0000 (23:47 -0400)
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 <zhangzengran@sangfor.com.cn>
(cherry picked from commit 70874399da47411e1e07824ef50dd82c4ebb6922)

src/osd/PrimaryLogPG.cc

index 97ce82aa71db8769ce7a4594975db214354b09c7..80838d44891eaab139b910d4eebda1b56c09c2ff 100644 (file)
@@ -8528,7 +8528,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),
@@ -8540,6 +8540,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();
   }
@@ -8572,7 +8573,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)
@@ -8585,6 +8586,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();
   }