]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: clear old_weight when using it to auto mark-in
authorSage Weil <sage@redhat.com>
Mon, 3 Oct 2016 14:17:00 +0000 (10:17 -0400)
committerSage Weil <sage@redhat.com>
Mon, 7 Nov 2016 16:28:43 +0000 (11:28 -0500)
We store an old weight when we (auto) mark down.  Clear that
weight when we auto-mark in.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 9ba604cc1b2261ab5b7b4e1af5cfee2e5e98dd60..b934bc587d7f7c44900248c1061ecd2cb391ee75 100644 (file)
@@ -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