From: Matan Breizman Date: Wed, 7 Jun 2023 12:35:59 +0000 (+0000) Subject: crimson/osd/osd: serialize MOSDMap message handling X-Git-Tag: v19.0.0~986^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=63fa59cbd285da369755412d93022393aad5aa36;p=ceph-ci.git crimson/osd/osd: serialize MOSDMap message handling See included comment for rationale. Fixes: https://tracker.ceph.com/issues/59165 Signed-off-by: Matan Breizman --- diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 735b6d777ca..2ec8fc48f6f 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -855,6 +855,25 @@ bool OSD::require_mon_peer(crimson::net::Connection *conn, Ref m) seastar::future<> OSD::handle_osd_map(crimson::net::ConnectionRef conn, Ref 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 m) { logger().info("handle_osd_map {}", *m); if (m->fsid != superblock.cluster_fsid) { diff --git a/src/crimson/osd/osd.h b/src/crimson/osd/osd.h index b3933e80c26..1069a4b2f2d 100644 --- a/src/crimson/osd/osd.h +++ b/src/crimson/osd/osd.h @@ -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 m); + seastar::future<> _handle_osd_map(crimson::net::ConnectionRef conn, + Ref m); seastar::future<> handle_pg_create(crimson::net::ConnectionRef conn, Ref m); seastar::future<> handle_osd_op(crimson::net::ConnectionRef conn,