]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: make sure the read lock is acquired when trying to get recovery read 38646/head
authorXuehan Xu <xxhdx1985126@gmail.com>
Sat, 19 Dec 2020 10:21:21 +0000 (18:21 +0800)
committerXuehan Xu <xxhdx1985126@gmail.com>
Sat, 19 Dec 2020 10:21:21 +0000 (18:21 +0800)
Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
src/crimson/common/tri_mutex.h
src/crimson/osd/object_context.h

index 3092c6f305cc97afdaa8a95907f4f5cd03a71c40..03e6474c40a44e50c79e994b03afc89e8e2a5b6f 100644 (file)
@@ -93,6 +93,9 @@ public:
   void unlock_for_read();
   void promote_from_read();
   void demote_to_read();
+  unsigned get_readers() const {
+    return readers;
+  }
 
   // for shared writers
   seastar::future<> lock_for_write(bool greedy);
@@ -100,11 +103,17 @@ public:
   void unlock_for_write();
   void promote_from_write();
   void demote_to_write();
+  unsigned get_writers() const {
+    return writers;
+  }
 
   // for exclusive users
   seastar::future<> lock_for_excl();
   bool try_lock_for_excl() noexcept;
   void unlock_for_excl();
+  bool is_excl_acquired() const {
+    return exclusively_used;
+  }
 
   bool is_acquired() const;
 
index 2527dd98262c2427c5840664756e272a041c312a..be238851e6a92a4dc53b4145bafd94bfc5055701 100644 (file)
@@ -155,6 +155,7 @@ public:
     }
   }
   void wait_recovery_read() {
+    assert(lock.get_readers() > 0);
     recovery_read_marker = true;
   }
   void drop_recovery_read() {