From: Ilya Dryomov Date: Tue, 29 Sep 2020 13:29:16 +0000 (+0200) Subject: mon: set session_timeout when adding to session_map X-Git-Tag: v14.2.14~4^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6d23592d48980baa4c916e28eaa4930c8ae043f;p=ceph.git mon: set session_timeout when adding to session_map With msgr2, the session is added in Monitor::ms_handle_accept() which is queued by ProtocolV2 at the end of handling CLIENT_IDENT frame, before responding with SERVER_IDENT frame. session_timeout is 0 and gets set only in Monitor::ms_dispatch(), so if the session trimming code in Monitor::tick() gets to the session before the peer receives our SERVER_IDENT, handles it, sends the first message and we receive it, the session is wrongly closed. This doesn't happen with msgr1, because there the session is added in Monitor::ms_dispatch(), upon receive of the first message (MSG_AUTH). Fixes: https://tracker.ceph.com/issues/47697 Signed-off-by: Ilya Dryomov (cherry picked from commit 76fbe8b4aaad7f39b37baf2f2d0128e9fe5c29a6) --- diff --git a/src/mon/Session.h b/src/mon/Session.h index b6d176f50cfd..e1f2835756f0 100644 --- a/src/mon/Session.h +++ b/src/mon/Session.h @@ -162,6 +162,9 @@ struct MonSessionMap { } void add_session(MonSession *s) { + s->session_timeout = ceph_clock_now(); + s->session_timeout += g_conf()->mon_session_timeout; + sessions.push_back(&s->item); s->get(); if (s->name.is_osd() &&