From 877fb294d404f8a9fd8b8684967f184d2baa2a89 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 3 Oct 2016 10:17:00 -0400 Subject: [PATCH] mon/OSDMonitor: clear old_weight when using it to auto mark-in We store an old weight when we (auto) mark down. Clear that weight when we auto-mark in. Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 9ba604cc1b22..b934bc587d7f 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2181,20 +2181,6 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op) if (!m->hb_front_addr.is_blank_ip()) pending_inc.new_hb_front_up[from] = m->hb_front_addr; - // mark in? - if ((g_conf->mon_osd_auto_mark_auto_out_in && (oldstate & CEPH_OSD_AUTOOUT)) || - (g_conf->mon_osd_auto_mark_new_in && (oldstate & CEPH_OSD_NEW)) || - (g_conf->mon_osd_auto_mark_in)) { - if (can_mark_in(from)) { - if (osdmap.osd_xinfo[from].old_weight > 0) - pending_inc.new_weight[from] = osdmap.osd_xinfo[from].old_weight; - else - pending_inc.new_weight[from] = CEPH_OSD_IN; - } else { - dout(7) << "prepare_boot NOIN set, will not mark in " << m->get_orig_source_addr() << dendl; - } - } - down_pending_out.erase(from); // if any if (m->sb.weight) @@ -2265,6 +2251,24 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op) else xi.features = m->get_connection()->get_features(); + // mark in? + if ((g_conf->mon_osd_auto_mark_auto_out_in && + (oldstate & CEPH_OSD_AUTOOUT)) || + (g_conf->mon_osd_auto_mark_new_in && (oldstate & CEPH_OSD_NEW)) || + (g_conf->mon_osd_auto_mark_in)) { + if (can_mark_in(from)) { + if (osdmap.osd_xinfo[from].old_weight > 0) { + pending_inc.new_weight[from] = osdmap.osd_xinfo[from].old_weight; + xi.old_weight = 0; + } else { + pending_inc.new_weight[from] = CEPH_OSD_IN; + } + } else { + dout(7) << "prepare_boot NOIN set, will not mark in " + << m->get_orig_source_addr() << dendl; + } + } + pending_inc.new_xinfo[from] = xi; // wait -- 2.47.3