From c43238b30a36ec2a2ac8d2060af5907be6b876c1 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 23 Sep 2023 12:28:02 -0700 Subject: [PATCH] fix waiting condition --- weed/util/lock_table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/util/lock_table.go b/weed/util/lock_table.go index b27104a11..fd6e1987a 100644 --- a/weed/util/lock_table.go +++ b/weed/util/lock_table.go @@ -65,7 +65,7 @@ func (lt *LockTable[T]) AcquireLock(intention string, key T, lockType LockType) // If the lock is held exclusively, wait entry.mu.Lock() - if len(entry.waiters) > 0 || lockType == ExclusiveLock { + if len(entry.waiters) > 0 || lockType == ExclusiveLock || entry.activeExclusiveLockOwnerCount > 0 { if glog.V(4) { fmt.Printf("ActiveLock %d %s wait for %+v type=%v with waiters %d active r%d w%d.\n", lock.ID, lock.intention, key, lockType, len(entry.waiters), entry.activeSharedLockOwnerCount, entry.activeExclusiveLockOwnerCount) if len(entry.waiters) > 0 {