From ed1d11ebdb72ca60952ca82f214d837a909af69e Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Sun, 9 Jul 2017 11:28:34 +0100 Subject: [PATCH] mon/Monitor: recreate mon session if features changed Fixes: http://tracker.ceph.com/issues/20433 Signed-off-by: Joao Eduardo Luis --- src/mon/Monitor.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index e9b26f9d4046..00e129ac2f3c 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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, -- 2.47.3