mirror of
https://github.com/ceph/ceph
synced 2025-01-04 02:02:36 +00:00
mds/MDSRank: improve is_stale_message to handle addrvecs
If we get a connection on a loopback from ourselves, get_source_addrs() will have everything we bound to, but the mdsmap may only have the v1 address. Avoid the addrvec comparison by instead comparing the ConnectionRefs. NOTE: this implementation is a stopgap. We should really maintain a map of ConnectionRefs for the current up set and compare the ConnectionRefs directly instead of comparing addr(vecs). Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
76ccf140ed
commit
9e63e63468
@ -1248,9 +1248,23 @@ bool MDSRank::is_stale_message(const Message::const_ref &m) const
|
||||
// from bad mds?
|
||||
if (m->get_source().is_mds()) {
|
||||
mds_rank_t from = mds_rank_t(m->get_source().num());
|
||||
if (!mdsmap->have_inst(from) ||
|
||||
mdsmap->get_addrs(from) != m->get_source_addrs() ||
|
||||
mdsmap->is_down(from)) {
|
||||
bool bad = false;
|
||||
if (mdsmap->is_down(from)) {
|
||||
bad = true;
|
||||
} else {
|
||||
// FIXME: this is a convoluted check. we should be maintaining a nice
|
||||
// clean map of current ConnectionRefs for current mdses!!!
|
||||
auto c = messenger->connect_to(CEPH_ENTITY_TYPE_MDS,
|
||||
mdsmap->get_addrs(from));
|
||||
if (c != m->get_connection()) {
|
||||
bad = true;
|
||||
dout(5) << " mds." << from << " should be " << c << " "
|
||||
<< c->get_peer_addrs() << " but this message is "
|
||||
<< m->get_connection() << " " << m->get_source_addrs()
|
||||
<< dendl;
|
||||
}
|
||||
}
|
||||
if (bad) {
|
||||
// bogus mds?
|
||||
if (m->get_type() == CEPH_MSG_MDS_MAP) {
|
||||
dout(5) << "got " << *m << " from old/bad/imposter mds " << m->get_source()
|
||||
|
Loading…
Reference in New Issue
Block a user