]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/osd: serialize MOSDMap message handling
authorMatan Breizman <mbreizma@redhat.com>
Wed, 7 Jun 2023 12:35:59 +0000 (12:35 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 11 Oct 2023 11:35:46 +0000 (11:35 +0000)
See included comment for rationale.

Fixes: https://tracker.ceph.com/issues/59165
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit 63fa59cbd285da369755412d93022393aad5aa36)

src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index 735b6d777ca913ef0c2334a9ea8e4df6d17c61a0..2ec8fc48f6f71c47b9798893334082af876e2d9a 100644 (file)
@@ -855,6 +855,25 @@ bool OSD::require_mon_peer(crimson::net::Connection *conn, Ref<Message> m)
 
 seastar::future<> OSD::handle_osd_map(crimson::net::ConnectionRef conn,
                                       Ref<MOSDMap> m)
+{
+  /* Ensure that only one MOSDMap is processed at a time.  Allowing concurrent
+  * processing may eventually be worthwhile, but such an implementation would
+  * need to ensure (among other things)
+  * 1. any particular map is only processed once
+  * 2. PGAdvanceMap operations are processed in order for each PG
+  * As map handling is not presently a bottleneck, we stick to this
+  * simpler invariant for now.
+  * See https://tracker.ceph.com/issues/59165
+  */
+  return handle_osd_map_lock.lock().then([=, this] {
+    return _handle_osd_map(conn, m);
+  }).finally([=, this] {
+    return handle_osd_map_lock.unlock();
+  });
+}
+
+seastar::future<> OSD::_handle_osd_map(crimson::net::ConnectionRef conn,
+                                      Ref<MOSDMap> m)
 {
   logger().info("handle_osd_map {}", *m);
   if (m->fsid != superblock.cluster_fsid) {
index b3933e80c268cba7e4433a362867ca7136a49705..1069a4b2f2d8a2e84e4caa24cfd6312d5fdc8590 100644 (file)
@@ -90,6 +90,8 @@ class OSD final : public crimson::net::Dispatcher,
 
   ceph::mono_time startup_time;
 
+  seastar::shared_mutex handle_osd_map_lock;
+
   OSDSuperblock superblock;
 
   // Dispatcher methods
@@ -168,6 +170,8 @@ private:
 
   seastar::future<> handle_osd_map(crimson::net::ConnectionRef conn,
                                    Ref<MOSDMap> m);
+  seastar::future<> _handle_osd_map(crimson::net::ConnectionRef conn,
+                                    Ref<MOSDMap> m);
   seastar::future<> handle_pg_create(crimson::net::ConnectionRef conn,
                                     Ref<MOSDPGCreate2> m);
   seastar::future<> handle_osd_op(crimson::net::ConnectionRef conn,