From e9fa13485ebf7dfdd98260deed3d6ec8d5e35213 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 5 Mar 2024 12:19:42 -0500 Subject: [PATCH] mds: prevent new wrlocks on LocalLock if there exists any xlock waiter 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 (cherry picked from commit bddd3c72014dc7aa4bb4f16e4633111a0f2e0bb0) --- src/mds/LocalLockC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/LocalLockC.h b/src/mds/LocalLockC.h index 4d26a1c3e14..a4df37bbcfe 100644 --- a/src/mds/LocalLockC.h +++ b/src/mds/LocalLockC.h @@ -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()); -- 2.39.5