mon/OSDMonitor: do not clobber pending xinfo during boot

If we have a pending xinfo change and also process a boot message, we
should not throw out the pending xinfo change.

This triggers when you mark an osd down and it sends both a MOSDMarkMeDead
and a new MOSDBoot message in quick succession: the first message sets
dead_epoch but the boot message processing clobbers it.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-07-09 13:54:33 -05:00
parent b75e17159b
commit 7f89617b64

View File

@ -3202,7 +3202,9 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op)
pair<epoch_t,epoch_t>(begin, end);
}
osd_xinfo_t xi = osdmap.get_xinfo(from);
if (pending_inc.new_xinfo.count(from) == 0)
pending_inc.new_xinfo[from] = osdmap.osd_xinfo[from];
osd_xinfo_t& xi = pending_inc.new_xinfo[from];
if (m->boot_epoch == 0) {
xi.laggy_probability *= (1.0 - g_conf()->mon_osd_laggy_weight);
xi.laggy_interval *= (1.0 - g_conf()->mon_osd_laggy_weight);
@ -3237,8 +3239,8 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op)
(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;
if (xi.old_weight > 0) {
pending_inc.new_weight[from] = xi.old_weight;
xi.old_weight = 0;
} else {
pending_inc.new_weight[from] = CEPH_OSD_IN;
@ -3249,8 +3251,6 @@ bool OSDMonitor::prepare_boot(MonOpRequestRef op)
}
}
pending_inc.new_xinfo[from] = xi;
// wait
wait_for_finished_proposal(op, new C_Booted(this, op));
}