]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: recreate mon session if features changed 16230/head
authorJoao Eduardo Luis <joao@suse.de>
Sun, 9 Jul 2017 10:28:34 +0000 (11:28 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Sun, 9 Jul 2017 15:51:08 +0000 (16:51 +0100)
Fixes: http://tracker.ceph.com/issues/20433
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/Monitor.cc

index e9b26f9d404699a75996394f78d1f2f370a4ee7c..00e129ac2f3c8942fe17064a4ae4242f9c679ebb 100644 (file)
@@ -3793,6 +3793,30 @@ void Monitor::_ms_dispatch(Message *m)
   if (s && s->closed) {
     return;
   }
+
+  if (src_is_mon && s) {
+    ConnectionRef con = m->get_connection();
+    if (con->get_messenger() && con->get_features() != s->con_features) {
+      // only update features if this is a non-anonymous connection
+      dout(10) << __func__ << " feature change for " << m->get_source_inst()
+               << " (was " << s->con_features
+               << ", now " << con->get_features() << ")" << dendl;
+      // connection features changed - recreate session.
+      if (s->con && s->con != con) {
+        dout(10) << __func__ << " connection for " << m->get_source_inst()
+                 << " changed from session; mark down and replace" << dendl;
+        s->con->mark_down();
+      }
+      if (s->item.is_on_list()) {
+        // forwarded messages' sessions are not in the sessions map and
+        // exist only while the op is being handled.
+        remove_session(s);
+      }
+      s->put();
+      s = nullptr;
+    }
+  }
+
   if (!s) {
     // if the sender is not a monitor, make sure their first message for a
     // session is an MAuth.  If it is not, assume it's a stray message,