From: Kefu Chai Date: Tue, 16 Jun 2026 12:25:45 +0000 (+0800) Subject: crimson/net: log io_state_t out of line in shard_states_t X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=846f9294c6ee5b13ed0194a9fabea79023ec0549;p=ceph.git crimson/net: log io_state_t out of line in shard_states_t try_enter_out_dispatching()'s impossible default case logs io_state_t, which would instantiate fmt::formatter inside IOHandler, before the formatter (declarable only after the class, since io_state_t is nested) is visible. move just that abort path to io_handler.cc, where the formatter is in scope, and keep the hot switch inline. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/net/io_handler.cc b/src/crimson/net/io_handler.cc index c08bdc87422..df55f1b6f07 100644 --- a/src/crimson/net/io_handler.cc +++ b/src/crimson/net/io_handler.cc @@ -1293,6 +1293,14 @@ IOHandler::shard_states_t::notify_out_dispatching_stopped( } } +void +IOHandler::shard_states_t::abort_wrong_io_state(SocketConnection &conn) +{ + logger().error("{} try_enter_out_dispatching() got wrong io_state {}", + conn, io_state); + ceph_abort_msg("impossible"); +} + seastar::future<> IOHandler::shard_states_t::wait_io_exit_dispatching() { diff --git a/src/crimson/net/io_handler.h b/src/crimson/net/io_handler.h index 9cb489af941..c86419c76b8 100644 --- a/src/crimson/net/io_handler.h +++ b/src/crimson/net/io_handler.h @@ -326,13 +326,16 @@ public: // do not dispatch out return false; default: - crimson::get_logger(ceph_subsys_ms).error( - "{} try_enter_out_dispatching() got wrong io_state {}", - conn, io_state); - ceph_abort_msg("impossible"); + abort_wrong_io_state(conn); } } + // defined out of line: logging io_state_t here, inside IOHandler, would + // instantiate fmt::formatter before it is declared (it can + // only be declared after IOHandler). only this impossible-state path + // formats it, so keep the hot switch inline and move the abort out. + [[noreturn]] void abort_wrong_io_state(SocketConnection &conn); + void notify_out_dispatching_stopped( const char *what, SocketConnection &conn);