]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: during shutdown don't accept new authentication and create new sessions 55597/head
authorNitzan Mordechai <nmordech@redhat.com>
Thu, 1 Jun 2023 09:30:48 +0000 (09:30 +0000)
committernmordech@redhat.com <nmordech@redhat.com>
Thu, 15 Feb 2024 10:41:41 +0000 (10:41 +0000)
During shutdown, the monitor is designed not to accept new authentication requests
or create new sessions. However, a problem arises when the monitor marks its status
as "shutdown" but still accepts new authentication requests and creates new sessions.
This issue causes the monitor to fail when checking the session list.

To fix this problem, an update is implemented. With this fix,
a monitor in the "shutdown" state will correctly reject new authentication requests
and prevent the creation of new sessions.
This ensures that the monitor operates as intended during the shutdown process.

Fixes: https://tracker.ceph.com/issues/56192
Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
(cherry picked from commit 4a8c21e3763dad41555765143f4b76f3a543b4f4)

src/mon/Monitor.cc

index 0f6edb6070191ce32132440c0fd8a70a6d0b20f0..462fedcfd3c0a080b495c7590df6f8db855093ea 100644 (file)
@@ -280,7 +280,6 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
 Monitor::~Monitor()
 {
   op_tracker.on_shutdown();
-
   delete logger;
   ceph_assert(session_map.sessions.empty());
 }
@@ -6532,6 +6531,11 @@ int Monitor::ms_handle_fast_authentication(Connection *con)
   MonSession *s = static_cast<MonSession*>(priv.get());
   if (!s) {
     // must be msgr2, otherwise dispatch would have set up the session.
+    if (state == STATE_SHUTDOWN) {
+      dout(10) << __func__ << " ignoring new con " << con << " (shutdown)" << dendl;
+      con->mark_down();
+      return -EACCES;
+    }
     s = session_map.new_session(
       entity_name_t(con->get_peer_type(), -1),  // we don't know yet
       con->get_peer_addrs(),