From: Patrick Donnelly Date: Mon, 10 Jul 2023 20:56:43 +0000 (-0400) Subject: msg: indicate ms_handle_authentication is fast X-Git-Tag: v16.2.15~198^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=10dbcf74e7e67514005a079972ef0cd7560130cd;p=ceph.git msg: indicate ms_handle_authentication is fast Like other fast Dispatcher methods, it must not acquire locks or do anything that might take a long time. Signed-off-by: Patrick Donnelly (cherry picked from commit 3e2075103a0ab6b7ced5800db1d44d13b1c8b7e6) --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index de8f8838f9d5..009c6c31e794 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -1070,7 +1070,7 @@ bool MDSDaemon::parse_caps(const AuthCapsInfo& info, MDSAuthCaps& caps) } } -int MDSDaemon::ms_handle_authentication(Connection *con) +int MDSDaemon::ms_handle_fast_authentication(Connection *con) { /* N.B. without mds_lock! */ MDSAuthCaps caps; diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 97162cc88559..35a9330f1b59 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -146,7 +146,7 @@ class MDSDaemon : public Dispatcher { private: bool ms_dispatch2(const ref_t &m) override; - int ms_handle_authentication(Connection *con) override; + int ms_handle_fast_authentication(Connection *con) override; void ms_handle_accept(Connection *con) override; void ms_handle_connect(Connection *con) override; bool ms_handle_reset(Connection *con) override; diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 15cd9f0e7e02..b1c1213e03ad 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -171,7 +171,7 @@ entity_addrvec_t DaemonServer::get_myaddrs() const return msgr->get_myaddrs(); } -int DaemonServer::ms_handle_authentication(Connection *con) +int DaemonServer::ms_handle_fast_authentication(Connection *con) { auto s = ceph::make_ref(cct); con->set_priv(s); diff --git a/src/mgr/DaemonServer.h b/src/mgr/DaemonServer.h index a4cf990bd319..eaaac41b71cd 100644 --- a/src/mgr/DaemonServer.h +++ b/src/mgr/DaemonServer.h @@ -269,7 +269,7 @@ public: ~DaemonServer() override; bool ms_dispatch2(const ceph::ref_t& m) override; - int ms_handle_authentication(Connection *con) override; + int ms_handle_fast_authentication(Connection *con) override; bool ms_handle_reset(Connection *con) override; void ms_handle_remote_reset(Connection *con) override {} bool ms_handle_refused(Connection *con) override; diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index f08608c6133d..9931caa58000 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -773,7 +773,7 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) } if (ret > 0) { if (!s->authenticated && - mon.ms_handle_authentication(s->con.get()) > 0) { + mon.ms_handle_fast_authentication(s->con.get()) > 0) { finished = true; } ret = 0; diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index a9fba82883b9..357a1a2764c6 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1570,7 +1570,7 @@ int MonClient::handle_auth_request( // for some channels prior to nautilus (osd heartbeat), we // tolerate the lack of an authorizer. if (!con->get_messenger()->require_authorizer) { - handle_authentication_dispatcher->ms_handle_authentication(con); + handle_authentication_dispatcher->ms_handle_fast_authentication(con); return 1; } return -EACCES; @@ -1608,7 +1608,7 @@ int MonClient::handle_auth_request( &auth_meta->connection_secret, ac); if (isvalid) { - handle_authentication_dispatcher->ms_handle_authentication(con); + handle_authentication_dispatcher->ms_handle_fast_authentication(con); return 1; } if (!more && !was_challenge && auth_meta->authorizer_challenge) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 26ea7acd2f59..ffc99ec24b7c 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -6352,7 +6352,7 @@ int Monitor::handle_auth_request( &auth_meta->connection_secret, &auth_meta->authorizer_challenge); if (isvalid) { - ms_handle_authentication(con); + ms_handle_fast_authentication(con); return 1; } if (!more && !was_challenge && auth_meta->authorizer_challenge) { @@ -6473,7 +6473,7 @@ int Monitor::handle_auth_request( } if (r > 0 && !s->authenticated) { - ms_handle_authentication(con); + ms_handle_fast_authentication(con); } dout(30) << " r " << r << " reply:\n"; @@ -6511,7 +6511,7 @@ void Monitor::ms_handle_accept(Connection *con) } } -int Monitor::ms_handle_authentication(Connection *con) +int Monitor::ms_handle_fast_authentication(Connection *con) { if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) { // mon <-> mon connections need no Session, and setting one up diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 1093649bb3df..e52fb974d5b6 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -957,7 +957,7 @@ public: MonCap mon_caps; bool get_authorizer(int dest_type, AuthAuthorizer **authorizer); public: // for AuthMonitor msgr1: - int ms_handle_authentication(Connection *con) override; + int ms_handle_fast_authentication(Connection *con) override; private: void ms_handle_accept(Connection *con) override; bool ms_handle_reset(Connection *con) override; diff --git a/src/msg/Dispatcher.h b/src/msg/Dispatcher.h index 5e025437b535..885f1843b31c 100644 --- a/src/msg/Dispatcher.h +++ b/src/msg/Dispatcher.h @@ -204,13 +204,16 @@ public: /** * handle successful authentication (msgr2) * - * Authenticated result/state will be attached to the Connection. + * Authenticated result/state will be attached to the Connection. This is + * called via the MonClient. + * + * Do not acquire locks in this method! It is considered "fast" delivery. * * return 1 for success * return 0 for no action (let another Dispatcher handle it) * return <0 for failure (failure to parse caps, for instance) */ - virtual int ms_handle_authentication(Connection *con) { + virtual int ms_handle_fast_authentication(Connection *con) { return 0; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index c8f87a18bd5c..e0d8d78650a1 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7338,7 +7338,7 @@ void OSD::ms_fast_dispatch(Message *m) OID_EVENT_TRACE_WITH_MSG(m, "MS_FAST_DISPATCH_END", false); } -int OSD::ms_handle_authentication(Connection *con) +int OSD::ms_handle_fast_authentication(Connection *con) { int ret = 0; auto s = ceph::ref_cast(con->get_priv()); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 9efb2b62cba7..0e9bc06a3b79 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1572,7 +1572,7 @@ public: bool ms_handle_refused(Connection *con) override { return osd->ms_handle_refused(con); } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return true; } } heartbeat_dispatcher; @@ -2033,7 +2033,7 @@ private: void ms_handle_connect(Connection *con) override; void ms_handle_fast_connect(Connection *con) override; void ms_handle_fast_accept(Connection *con) override; - int ms_handle_authentication(Connection *con) override; + int ms_handle_fast_authentication(Connection *con) override; bool ms_handle_reset(Connection *con) override; void ms_handle_remote_reset(Connection *con) override {} bool ms_handle_refused(Connection *con) override; diff --git a/src/test/fio/fio_ceph_messenger.cc b/src/test/fio/fio_ceph_messenger.cc index 4a4cf4fb5751..e5e170288ffe 100644 --- a/src/test/fio/fio_ceph_messenger.cc +++ b/src/test/fio/fio_ceph_messenger.cc @@ -268,7 +268,7 @@ public: bool ms_handle_refused(Connection *con) override { return false; } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } }; diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc index 0e5c5ab367f2..32fa4002f5fe 100644 --- a/src/test/msgr/perf_msgr_client.cc +++ b/src/test/msgr/perf_msgr_client.cc @@ -57,7 +57,7 @@ class MessengerClient { bool ms_handle_reset(Connection *con) override { return true; } void ms_handle_remote_reset(Connection *con) override {} bool ms_handle_refused(Connection *con) override { return false; } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } }; diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc index f17f90f6d081..67bb591a9031 100644 --- a/src/test/msgr/perf_msgr_server.cc +++ b/src/test/msgr/perf_msgr_server.cc @@ -100,7 +100,7 @@ class ServerDispatcher : public Dispatcher { //cerr << __func__ << " reply message=" << m << std::endl; op_wq.queue(m); } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } }; diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index 3ebe320be119..8e4506a4ef08 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -215,7 +215,7 @@ class FakeDispatcher : public Dispatcher { cond.notify_all(); } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } @@ -1704,7 +1704,7 @@ class SyntheticDispatcher : public Dispatcher { } } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } @@ -2262,7 +2262,7 @@ class MarkdownDispatcher : public Dispatcher { void ms_fast_dispatch(Message *m) override { ceph_abort(); } - int ms_handle_authentication(Connection *con) override { + int ms_handle_fast_authentication(Connection *con) override { return 1; } };