From a6ecc0658472695aab5075b733a90ddf924fdeb8 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 25 Nov 2022 09:54:56 +0800 Subject: [PATCH] crimson/net: move ms_handle_accept into the replacing gate To prevent others to close the connection before the gate, and causing abort without proper closing the moving socket. Signed-off-by: Yingxin Cheng --- src/crimson/net/ProtocolV2.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 7028e158c25ee..72f303b908f52 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -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(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(conn.shared_from_this())); + // state may become CLOSING, close mover.socket and abort later return wait_out_exit_dispatching( ).then([this] { protocol_timer.cancel(); -- 2.39.5