From: Yingxin Cheng Date: Tue, 21 Jan 2025 03:14:04 +0000 (+0800) Subject: crimson/net/io_handler: drop io_state_t::none X-Git-Tag: v20.0.0~202^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5550486c778ef32a9dcae4f9fa5d5fc3c667314e;p=ceph.git crimson/net/io_handler: drop io_state_t::none io_state_t::none was introduced to resemble async msgr and used by the single-shard crimson msgr to mark that the connection is invisible by any user during accepting. But it isn't simple in multi-shard crimson msgr because the ordering is impossible to predict among the connection user, connection and the msgr shards if they are in 3 different shards. So drop io_state_t::none. Fixes: https://tracker.ceph.com/issues/66606 Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 58d5c87638954..7942adc7ef183 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -1624,7 +1624,7 @@ ProtocolV2::server_reconnect() void ProtocolV2::execute_accepting() { assert(is_socket_valid); - trigger_state(state_t::ACCEPTING, io_state_t::none); + trigger_state(state_t::ACCEPTING, io_state_t::delay); gate.dispatch_in_background("execute_accepting", conn, [this] { return seastar::futurize_invoke([this] { #ifdef UNIT_TESTS_BUILT @@ -2190,7 +2190,7 @@ void ProtocolV2::execute_wait(bool max_backoff) void ProtocolV2::execute_server_wait() { ceph_assert_always(is_socket_valid); - trigger_state(state_t::SERVER_WAIT, io_state_t::none); + trigger_state(state_t::SERVER_WAIT, io_state_t::delay); gated_execute("execute_server_wait", conn, [this] { return frame_assembler->read_exactly(1 ).then([this](auto bptr) { diff --git a/src/crimson/net/io_handler.cc b/src/crimson/net/io_handler.cc index 7b86a35c493c8..acd6147710b5b 100644 --- a/src/crimson/net/io_handler.cc +++ b/src/crimson/net/io_handler.cc @@ -49,7 +49,7 @@ namespace crimson::net { IOHandler::IOHandler(ChainedDispatchers &dispatchers, SocketConnection &conn) : shard_states(shard_states_t::create( - seastar::this_shard_id(), io_state_t::none)), + seastar::this_shard_id(), io_state_t::delay)), dispatchers(dispatchers), conn(conn), conn_ref(conn.get_local_shared_foreign_from_this()) @@ -292,7 +292,6 @@ seastar::future<> IOHandler::do_send_keepalive( void IOHandler::mark_down() { ceph_assert_always(seastar::this_shard_id() == get_shard_id()); - ceph_assert_always(get_io_state() != io_state_t::none); need_dispatch_reset = false; if (get_io_state() == io_state_t::drop) { return; @@ -355,8 +354,7 @@ void IOHandler::do_set_io_state( fa ? "present" : "N/A", set_notify_out, io_stat_printer{*this}); ceph_assert_always(!( - (new_state == io_state_t::none && prv_state != io_state_t::none) || - (new_state == io_state_t::open && prv_state == io_state_t::open) + new_state == io_state_t::open && prv_state == io_state_t::open )); if (prv_state == io_state_t::drop) { @@ -791,12 +789,12 @@ seastar::future<> IOHandler::set_accepted_sid( ConnectionFRef conn_fref) { assert(seastar::this_shard_id() == get_shard_id()); - assert(get_io_state() == io_state_t::none); + assert(get_io_state() == io_state_t::delay); ceph_assert_always(conn_ref); conn_ref.reset(); assert(maybe_prv_shard_states == nullptr); shard_states.reset(); - shard_states = shard_states_t::create(sid, io_state_t::none); + shard_states = shard_states_t::create(sid, io_state_t::delay); logger().debug("{} send {} set_accepted_sid() to core {}", conn, cc_seq, sid); return seastar::smp::submit_to(sid, [this, cc_seq, conn_fref=std::move(conn_fref)]() mutable { @@ -805,7 +803,7 @@ seastar::future<> IOHandler::set_accepted_sid( logger().debug("{} set accepted sid", conn); ceph_assert_always(seastar::this_shard_id() == get_shard_id()); - ceph_assert_always(get_io_state() == io_state_t::none); + ceph_assert_always(get_io_state() == io_state_t::delay); assert(maybe_prv_shard_states == nullptr); ceph_assert_always(!conn_ref); conn_ref = make_local_shared_foreign(std::move(conn_fref)); diff --git a/src/crimson/net/io_handler.h b/src/crimson/net/io_handler.h index 41c76ab925b84..c64e7a0f6526c 100644 --- a/src/crimson/net/io_handler.h +++ b/src/crimson/net/io_handler.h @@ -200,7 +200,6 @@ public: * io behavior accordingly. */ enum class io_state_t : uint8_t { - none, // no IO is possible as the connection is not available to the user yet. delay, // IO is delayed until open. open, // Dispatch In and Out concurrently. drop, // Drop IO as the connection is closed. @@ -562,9 +561,6 @@ struct fmt::formatter using enum crimson::net::IOHandler::io_state_t; std::string_view name; switch (state) { - case none: - name = "none"; - break; case delay: name = "delay"; break;