]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: use std::unique_lock when appropriate
authorKefu Chai <k.chai@proxmox.com>
Fri, 12 Jun 2026 08:36:32 +0000 (16:36 +0800)
committerKefu Chai <k.chai@proxmox.com>
Wed, 17 Jun 2026 10:54:08 +0000 (18:54 +0800)
instead of lock and unlock a mutex manually, let's use the RAII
helper. simpler this way.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/crimson/osd/osd.cc

index 63b5d4901cc2738b50db3666ba183f5765c9e4a1..0030e04a781b488b71d3acb5ca53ebadb70be474 100644 (file)
@@ -1187,11 +1187,8 @@ seastar::future<> OSD::handle_osd_map(Ref<MOSDMap> m)
   * See https://tracker.ceph.com/issues/59165
   */
   ceph_assert(seastar::this_shard_id() == PRIMARY_CORE);
-  return handle_osd_map_lock.lock().then([this, m] {
-    return _handle_osd_map(m);
-  }).finally([this] {
-    return handle_osd_map_lock.unlock();
-  });
+  const auto lock = co_await seastar::get_unique_lock(handle_osd_map_lock);
+  co_await _handle_osd_map(m);
 }
 
 seastar::future<> OSD::_handle_osd_map(Ref<MOSDMap> m)