]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: drop entry in failure_pending when resetting stale peer 41213/head
authorKefu Chai <kchai@redhat.com>
Sun, 14 Mar 2021 03:56:59 +0000 (11:56 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 7 May 2021 03:08:12 +0000 (11:08 +0800)
no need to keep it in the pending list anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit ff077fc3ea7d1595679c7053cda3b16d68aefd01)

src/osd/OSD.cc

index a4ce5ee3a138dfe0e3db25c70e4bb49288dac505..c21b9acdc32f51b6bc479de184214d9cc21f1ff3 100644 (file)
@@ -5167,17 +5167,18 @@ void OSD::reset_heartbeat_peers(bool all)
   stale -= cct->_conf.get_val<int64_t>("osd_heartbeat_stale");
   std::lock_guard l(heartbeat_lock);
   for (auto it = heartbeat_peers.begin(); it != heartbeat_peers.end();) {
-    HeartbeatInfo& hi = it->second;
+    auto& [peer, hi] = *it;
     if (all || hi.is_stale(stale)) {
       hi.con_back->mark_down();
       if (hi.con_front) {
         hi.con_front->mark_down();
       }
       // stop sending failure_report to mon too
-      failure_queue.erase(it->first);
-      heartbeat_peers.erase(it++);
+      failure_queue.erase(peer);
+      failure_pending.erase(peer);
+      it = heartbeat_peers.erase(it);
     } else {
-      it++;
+      ++it;
     }
   }
 }