osd: drop messages from before we moved back to boot state

We want to make sure we ignore any messages sent to us before we moved
back to the boot state (after being wrongly marked down).  This is only
a problem currently while we are in the BOOT state and waiting to be
re-added to the map, because we may then call _share_map_incoming and
send something on the new rebound messenger to an old peer.  Also assert
that we are !booting there to be sure.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2011-01-14 16:57:38 -08:00
parent 4385aa567d
commit 818fa33a66

View File

@ -1360,7 +1360,7 @@ void OSD::handle_osd_ping(MOSDPing *m)
heartbeat_to[from] = m->peer_as_of_epoch;
heartbeat_inst[from] = m->get_source_inst();
if (locked && m->map_epoch)
if (locked && m->map_epoch && !is_booting())
_share_map_incoming(m->get_source_inst(), m->map_epoch,
(Session*) m->get_connection()->get_priv());
}
@ -1370,7 +1370,7 @@ void OSD::handle_osd_ping(MOSDPing *m)
// only take peer stat or share map now if map_lock is uncontended
if (locked) {
if (m->map_epoch)
if (m->map_epoch && !is_booting())
_share_map_incoming(m->get_source_inst(), m->map_epoch,
(Session*) m->get_connection()->get_priv());
take_peer_stat(from, m->peer_stat); // only with map_lock held!
@ -1956,6 +1956,8 @@ bool OSD::_share_map_incoming(const entity_inst_t& inst, epoch_t epoch,
dout(20) << "_share_map_incoming " << inst << " " << epoch << dendl;
//assert(osd_lock.is_locked());
assert(!is_booting());
// does client have old map?
if (inst.name.is_client()) {
bool sendmap = epoch < osdmap->get_epoch();
@ -3327,6 +3329,13 @@ bool OSD::require_same_or_newer_map(Message *m, epoch_t epoch)
}
}
// ok, we have at least as new a map as they do. are we (re)booting?
if (is_booting()) {
dout(7) << "still in boot state, dropping message " << *m << dendl;
m->put();
return false;
}
return true;
}