From d91c62dcf5b1c98b4cfed4eebf29ff9a9d64289b Mon Sep 17 00:00:00 2001 From: Dong Wu Date: Thu, 27 Oct 2016 11:02:36 +0800 Subject: [PATCH] mon: update mon(peon)'s down_pending_out when osd up Fixes: http://tracker.ceph.com/issues/17719 Signed-off-by: Dong Wu (cherry picked from commit 664254a17afbad86983ea5b5b8d385662d89e65e) Conflicts: src/mon/OSDMonitor.cc (auto declaration for variable "found" is a C++11ism, replace with the full verbose C++98 type) --- src/mon/OSDMonitor.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a006dbde648ff..7c847a610d2ca 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -274,12 +274,19 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) } for (int o = 0; o < osdmap.get_max_osd(); o++) { + if (osdmap.is_out(o)) + continue; + map::iterator found = down_pending_out.find(o); if (osdmap.is_down(o)) { // populate down -> out map - if (osdmap.is_in(o) && - down_pending_out.count(o) == 0) { - dout(10) << " adding osd." << o << " to down_pending_out map" << dendl; - down_pending_out[o] = ceph_clock_now(g_ceph_context); + if (found == down_pending_out.end()) { + dout(10) << " adding osd." << o << " to down_pending_out map" << dendl; + down_pending_out[o] = ceph_clock_now(g_ceph_context); + } + } else { + if (found != down_pending_out.end()) { + dout(10) << " removing osd." << o << " from down_pending_out map" << dendl; + down_pending_out.erase(found); } } } -- 2.39.5