]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDSRank: improve is_stale_message to handle addrvecs
authorSage Weil <sage@redhat.com>
Fri, 14 Dec 2018 21:53:30 +0000 (15:53 -0600)
committerSage Weil <sage@redhat.com>
Thu, 3 Jan 2019 17:17:31 +0000 (11:17 -0600)
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>
src/mds/MDSRank.cc

index 63c0d33619ef3c2e7c929051da09a671ee6cbb78..fc30422e3f1f946e07b5fc684dbc07d84442cdc3 100644 (file)
@@ -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()