From: Sage Weil Date: Fri, 14 Dec 2018 21:53:30 +0000 (-0600) Subject: mds/MDSRank: improve is_stale_message to handle addrvecs X-Git-Tag: v14.1.0~484^2~51 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e63e6346844fc258c0e6a5265fc09ae80dd5353;p=ceph-ci.git 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 --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 63c0d33619e..fc30422e3f1 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()