]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PrimaryLogPG: Avoid accessing destroyed references in finish_degraded_object
authorTao Ning <ningtao@sangfor.com.cn>
Wed, 14 Aug 2019 13:07:46 +0000 (21:07 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 15 Aug 2019 02:15:15 +0000 (10:15 +0800)
As follows:
for (auto i = callbacks_for_degraded_object.begin(); i != callbacks_for_degraded_object.end();) {
    finish_degraded_object((i++)->first);
}

void PrimaryLogPG::finish_degraded_object(const hobject_t oid)
{
  if (callbacks_for_degraded_object.count(oid)) {
    contexts.swap(callbacks_for_degraded_object[oid]);
    callbacks_for_degraded_object.erase(oid);   // Release
  }

  map<hobject_t, snapid_t>::iterator i = objects_blocked_on_degraded_snap.find(
    oid.get_head());  // Access
  ...
}

Fixes: https://tracker.ceph.com/issues/41250
Signed-off-by: Tao Ning <ningtao@sangfor.com.cn>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index 23f6dc5221154437eba00f8cfb36c65d3a210d89..1f1ae89353cd116775d59d06913ff9c419802eae 100644 (file)
@@ -11431,7 +11431,7 @@ void PrimaryLogPG::remove_missing_object(const hobject_t &soid,
   ceph_assert(r == 0);
 }
 
-void PrimaryLogPG::finish_degraded_object(const hobject_t& oid)
+void PrimaryLogPG::finish_degraded_object(const hobject_t oid)
 {
   dout(10) << __func__ << " " << oid << dendl;
   if (callbacks_for_degraded_object.count(oid)) {
index 3498a419f13d1d3c3e0cc133b537e1068c9dcb1a..ad4da78bed66e9d875a374a0d3455ae66c29e9ba 100644 (file)
@@ -1142,7 +1142,7 @@ protected:
                                  PGBackend::RecoveryHandle *h,
                                  bool *work_started);
 
-  void finish_degraded_object(const hobject_t& oid);
+  void finish_degraded_object(const hobject_t oid);
 
   // Cancels/resets pulls from peer
   void check_recovery_sources(const OSDMapRef& map) override ;