From: Tao Ning Date: Wed, 14 Aug 2019 13:07:46 +0000 (+0800) Subject: osd/PrimaryLogPG: Avoid accessing destroyed references in finish_degraded_object X-Git-Tag: v15.1.0~1867^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29663%2Fhead;p=ceph.git osd/PrimaryLogPG: Avoid accessing destroyed references in finish_degraded_object 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::iterator i = objects_blocked_on_degraded_snap.find( oid.get_head()); // Access ... } Fixes: https://tracker.ceph.com/issues/41250 Signed-off-by: Tao Ning --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 23f6dc522115..1f1ae89353cd 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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)) { diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3498a419f13d..ad4da78bed66 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -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 ;