]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: prevent new wrlocks on LocalLock if there exists any xlock waiter
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 5 Mar 2024 17:19:42 +0000 (12:19 -0500)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 20 Mar 2024 14:56:57 +0000 (10:56 -0400)
Otherwise, an xlock waiter can become starved as a LocalLock supports multiple
writers.

Strictly speaking, a new lock state would be appropriate for this but we cheat
frequently with the LocalLock -- there is only one state. All transition checks
are already manually performed by the Locker.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/LocalLockC.h

index 4d26a1c3e14299c917a26d652e3c240f89723e47..a4df37bbcfed55fcd2b91af460e03587789e7c42 100644 (file)
@@ -34,7 +34,7 @@ public:
   }
 
   bool can_wrlock() const {
-    return !is_xlocked();
+    return !is_xlocked() && !is_waiter_for(SimpleLock::WAIT_XLOCK);
   }
   void get_wrlock(client_t client) {
     ceph_assert(can_wrlock());