]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os, os/memstore: make the omap_iterate reentrant
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Nov 2024 22:13:18 +0000 (22:13 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 4 Apr 2025 18:21:54 +0000 (18:21 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/os/memstore/MemStore.cc
src/os/memstore/MemStore.h

index 24f172898e7cc716507d997208df8bffd48bfae5..0e7e19665df9ab6b8f59a091dd57f010a34d241a 100644 (file)
@@ -631,7 +631,7 @@ int MemStore::omap_iterate(
 
   bool more = false;
   {
-    std::lock_guard lock{o->omap_mutex};
+    std::shared_lock lock{o->omap_mutex};
 
     // obtain seek the iterator
     decltype(o->omap)::iterator it;
index fc0bc96db7beea3e16d052aabdfa6776b7957b65..358068fef477d1fbc9948d6e546a28f60aa4b73c 100644 (file)
@@ -33,7 +33,7 @@ class MemStore : public ObjectStore {
 public:
   struct Object : public RefCountedObject {
     ceph::mutex xattr_mutex{ceph::make_mutex("MemStore::Object::xattr_mutex")};
-    ceph::mutex omap_mutex{ceph::make_mutex("MemStore::Object::omap_mutex")};
+    ceph::shared_mutex omap_mutex{ceph::make_shared_mutex("MemStore::Object::omap_mutex")};
     std::map<std::string,ceph::buffer::ptr,std::less<>> xattr;
     ceph::buffer::list omap_header;
     std::map<std::string,ceph::buffer::list> omap;