]> git.apps.os.sepia.ceph.com Git - ceph.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>
Fri, 22 Mar 2024 15:38:03 +0000 (11:38 -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>
(cherry picked from commit bddd3c72014dc7aa4bb4f16e4633111a0f2e0bb0)

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());