]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: set session_timeout when adding to session_map 37494/head
authorIlya Dryomov <idryomov@gmail.com>
Tue, 29 Sep 2020 13:29:16 +0000 (15:29 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 30 Sep 2020 11:30:25 +0000 (13:30 +0200)
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 <idryomov@gmail.com>
src/mon/Session.h

index ef30b8e2926f6a064da5759b5c350132859f2acf..e7b076b6bcb30e0dbbf93a5f962513fa374b4860 100644 (file)
@@ -193,6 +193,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() &&