From 9e63e6346844fc258c0e6a5265fc09ae80dd5353 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 14 Dec 2018 15:53:30 -0600 Subject: [PATCH] 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 --- src/mds/MDSRank.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 63c0d33619ef3..fc30422e3f1f9 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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() -- 2.39.5