]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net/io_handler: drop io_state_t::none 61456/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Tue, 21 Jan 2025 03:14:04 +0000 (11:14 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 21 Jan 2025 03:33:10 +0000 (11:33 +0800)
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 <yingxin.cheng@intel.com>
src/crimson/net/ProtocolV2.cc
src/crimson/net/io_handler.cc
src/crimson/net/io_handler.h

index 58d5c87638954caa037c120545e56bf571baa6f3..7942adc7ef183ac0d283e0c9c53d599afdbe93e9 100644 (file)
@@ -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) {
index 7b86a35c493c82d4dfeac56fd30dd8986d4c5425..acd6147710b5b7856adfc9ae3ca863b92a2a6600 100644 (file)
@@ -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));
index 41c76ab925b844071926f3f39c1a20463dbd4d28..c64e7a0f6526cca62fe7d4435149df2540e0ee3a 100644 (file)
@@ -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<crimson::net::IOHandler::io_state_t>
     using enum crimson::net::IOHandler::io_state_t;
     std::string_view name;
     switch (state) {
-    case none:
-      name = "none";
-      break;
     case delay:
       name = "delay";
       break;