You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Resolve deadlock in directory operations using generation-based invalidation (#39)
* fix: Resolve deadlock in directory operations using generation-based invalidation
This fixes issue #37 where tigrisfs would deadlock during concurrent directory
operations, particularly when listing directories.
The deadlock occurred because:
1. listObjectsFlat() held dh.mu while calling sealDir()
2. sealDir() -> removeExpired() -> removeChildUnlocked() tried to lock ALL
directory handles' mutexes
3. Other threads could hold different directory handle mutexes while waiting
for dh.mu, creating a circular lock dependency
The solution uses a generation counter approach:
- Each directory maintains an atomic generation counter
- The counter increments on structural changes (add/remove children)
- Directory handles check the generation before operations
- If generation changed, handles reset their position without locking
* fix: Address race condition in generation handling after sealDir
* fix: Initialize DirHandle generation correctly to prevent spurious invalidations
0 commit comments