]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: move ms_handle_accept into the replacing gate
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 25 Nov 2022 01:54:56 +0000 (09:54 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 8 Feb 2023 06:07:41 +0000 (14:07 +0800)
To prevent others to close the connection before the gate, and causing
abort without proper closing the moving socket.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/ProtocolV2.cc

index 7028e158c25ee948dff219e13b355f696c8dde93..72f303b908f5289a0348479095ea656533876242 100644 (file)
@@ -1602,8 +1602,6 @@ void ProtocolV2::trigger_replacing(bool reconnect,
 {
   trigger_state(state_t::REPLACING, out_state_t::delay, false);
   frame_assembler.shutdown_socket();
-  dispatchers.ms_handle_accept(
-      seastar::static_pointer_cast<SocketConnection>(conn.shared_from_this()));
   gate.dispatch_in_background("trigger_replacing", *this,
                  [this,
                   reconnect,
@@ -1614,6 +1612,10 @@ void ProtocolV2::trigger_replacing(bool reconnect,
                   new_conn_features, new_peer_supported_features,
                   new_peer_global_seq,
                   new_connect_seq, new_msg_seq] () mutable {
+    ceph_assert_always(state == state_t::REPLACING);
+    dispatchers.ms_handle_accept(
+        seastar::static_pointer_cast<SocketConnection>(conn.shared_from_this()));
+    // state may become CLOSING, close mover.socket and abort later
     return wait_out_exit_dispatching(
     ).then([this] {
       protocol_timer.cancel();