Commit Graph
14 Commits
Author SHA1 Message Date
Copilot 5053927df4 fix(mount): correct operator precedence in shared lock wait condition
The shared lock wait loop on line 88 had a parenthesization bug that
caused the `|| entry.activeExclusiveLockOwnerCount > 0` check to fall
outside the `!lock.isDeleted` guard. Due to Go operator precedence
(&& binds tighter than ||), the condition evaluated as:

  (!lock.isDeleted && (waiters_check)) || exclusiveCount > 0

This meant a deleted (cancelled) shared lock waiter could never exit
the wait loop while any exclusive lock was active on the same key,
since the isDeleted check was bypassed. The goroutine would spin in
cond.Wait() forever, leaking and potentially cascading to block other
FUSE operations on the same file handle.

The fix adds parentheses to match the exclusive lock condition on
line 84, so isDeleted properly gates the entire wait expression:

  !lock.isDeleted && ((waiters_check) || exclusiveCount > 0)

This bug has existed since commit c43238b30 ("fix waiting condition")
but became more likely to trigger in recent versions due to increased
lock contention from parallel chunk fetching (#7569), directory handle
mutex (#7674), and metadata cache snapshot consistency (#8531).

Fixes #8696
2026-03-19 13:10:02 -07:00
Patrick Schmidt 96c48bd0da Fix deadlock in lock table locks (#5566) 2024-05-07 05:44:53 -07:00
chrislu 03c4b2e988 correct lock accounting
possibly fix https://github.com/seaweedfs/seaweedfs/issues/5082
2023-12-22 14:16:23 -08:00
chrislu 40888b5612 align 64bit atomic operation
fix https://github.com/seaweedfs/seaweedfs/issues/4878
2023-09-28 07:58:43 -07:00
chrislu 1df4223195 minor 2023-09-24 09:54:57 -07:00
chrislu 10ac25f857 avoid deleting the entry too early 2023-09-23 12:43:00 -07:00
chrislu c43238b30a fix waiting condition 2023-09-23 12:28:02 -07:00
chrislu 322af1fc04 fix compilation 2023-09-23 12:13:32 -07:00
chrislu 0414b68a4f if shared lock, still need to wait for exclusive lock to release 2023-09-23 12:08:23 -07:00
chrislu 9ba4639a27 adjust for better logs 2023-09-23 11:53:44 -07:00
chrislu 2df70ce95f adjust logs 2023-09-21 23:51:32 -07:00
chrislu 49a470bcdf reduce logs 2023-09-21 20:08:20 -07:00
chrislu 7669852241 adjust logs 2023-09-21 11:04:12 -07:00
chrislu e3b1bacf3f add lock table to ensure ordered locks 2023-09-21 10:24:34 -07:00