]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
osd/PrimaryLogPG: Avoid accessing destroyed references in finish_degraded_object 29994/head
authorTao Ning <ningtao@sangfor.com.cn>
Wed, 14 Aug 2019 13:07:46 +0000 (21:07 +0800)
committerNathan Cutler <ncutler@suse.com>
Wed, 2 Oct 2019 08:58:15 +0000 (10:58 +0200)
commita1401847eb218a844b700e5605b5324bd10cc6d1
treed72c6207a166bb7492945a1791550c4dc7bc22f4
parentaae09112a5adc8b1ab0effd0e5e414e48af1039e
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<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>
(cherry picked from commit 86d55c1a0ddb48efc0c1934728d27f22cf49dfa1)

Conflicts:
src/osd/PrimaryLogPG.h
- retained "override" in nautilus
- PrimaryLogPG derives from PGBackend::Listener in nautilus, and its
  PGBackend::Listener's only derived class. So we need to update
  PGBackend::Listener accordingly. (quoted from Kefu's mimic backport)
  NOTE: This is needed because 8a8947d2a32d6390cb17099398e7f2212660c9a1 went in
  post-nautilus and is not being backported.
src/osd/PGBackend.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h