From: Joao Eduardo Luis Date: Sun, 9 Jul 2017 10:28:34 +0000 (+0100) Subject: mon/Monitor: recreate mon session if features changed X-Git-Tag: v12.1.1~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16230%2Fhead;p=ceph.git mon/Monitor: recreate mon session if features changed Fixes: http://tracker.ceph.com/issues/20433 Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index e9b26f9d404..00e129ac2f3 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,