]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: register OSDs in ms_handle_accept 53188/head
authorPatrick Donnelly <pdonnell@redhat.com>
Mon, 3 Jul 2023 00:48:44 +0000 (20:48 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 28 Aug 2023 13:47:49 +0000 (09:47 -0400)
It's a no-no to acquire locks in these "fast" messenger methods. This
can lead to messenger slow downs in the best case as it's blocking reads
on the wire. In the worse case, the messenger may deadlock with other
threads, preventing any further message reads off the wire.

It's not obvious this method is "fast" so I've added a comment regarding
this.

Fixes: https://tracker.ceph.com/issues/61874
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 69980823e62f67d502c4045e15c41c5c44cd5127)

src/mgr/DaemonServer.cc
src/mgr/DaemonServer.h

index cefec9d5e4cf68dc079121261f488fc598502011..525f732fbe6db34207910c406c1f890cecae2153 100644 (file)
@@ -215,16 +215,19 @@ int DaemonServer::ms_handle_fast_authentication(Connection *con)
     dout(10) << " session " << s << " " << s->entity_name
              << " has caps " << s->caps << " '" << str << "'" << dendl;
   }
+  return 1;
+}
 
+void DaemonServer::ms_handle_accept(Connection* con)
+{
   if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD) {
+    auto s = ceph::ref_cast<MgrSession>(con->get_priv());
     std::lock_guard l(lock);
     s->osd_id = atoi(s->entity_name.get_id().c_str());
     dout(10) << "registering osd." << s->osd_id << " session "
             << s << " con " << con << dendl;
     osd_cons[s->osd_id].insert(con);
   }
-
-  return 1;
 }
 
 bool DaemonServer::ms_handle_reset(Connection *con)
index 40b7d2a813755d9e492b27f6a238eee3edede30d..a7b6456100439ec3f8d20058a9c34ee59fc6589d 100644 (file)
@@ -270,6 +270,7 @@ public:
 
   bool ms_dispatch2(const ceph::ref_t<Message>& m) override;
   int ms_handle_fast_authentication(Connection *con) override;
+  void ms_handle_accept(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;