]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/migration/HttpClient: socket isn't shut down on some state transitions 61079/head
authorIlya Dryomov <idryomov@gmail.com>
Thu, 12 Dec 2024 20:32:39 +0000 (21:32 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 13 Dec 2024 12:44:45 +0000 (13:44 +0100)
If shut_down() gets delayed until a) the state transition from
STATE_RESET_CONNECTING completes and the reconnect is unsuccessful or
b) the state transition from STATE_RESET_DISCONNECTING completes (i.e.
next_state is STATE_UNINITIALIZED or STATE_RESET_CONNECTING), the
socket needs to be shut down before m_on_shutdown is invoked.  The line
of thought here is the same as for the corresponding state transitions
that don't involve STATE_SHUTTING_DOWN.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/migration/HttpClient.cc

index a55c2dd0480fb08b66a250fbb9521df27e21f166..09fe91da02ae2dfe7da50d67da8f4b1c6403d4f6 100644 (file)
@@ -514,14 +514,17 @@ private:
         return;
       }
     } else if (current_state == STATE_SHUTTING_DOWN) {
+      ceph_assert(m_on_shutdown != nullptr);
       if (next_state == STATE_READY) {
         // shut down requested while connecting/resetting
         disconnect(new LambdaContext([this](int r) { handle_shut_down(r); }));
         return;
       } else if (next_state == STATE_UNINITIALIZED ||
-                 next_state == STATE_SHUTDOWN ||
                  next_state == STATE_RESET_CONNECTING) {
-        ceph_assert(m_on_shutdown != nullptr);
+        shutdown_socket();
+        m_on_shutdown->complete(r);
+        return;
+      } else if (next_state == STATE_SHUTDOWN) {
         m_on_shutdown->complete(r);
         return;
       }