Skip to content

🐛 fix(rw): close a link directory an ACL opened - #898

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/link-dir-acl
Oct 30, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/link-dir-acl

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

On ZFS with NFSv4 ACLs and aclinherit=passthrough, as on the reporter's TrueNAS system, every ReadWriteLock acquire in a group-writable directory failed with link directory ... was replaced while opening. 🐛 #897 hit it through Paperless-ngx 3.4.0, which moved to filelock 4.2.4. With this change those locks work. The only remaining case is a directory whose ACL refuses chmod; it now fails with an error that says what to change.

In such a directory, SQLite connects through a link inside a private directory beside the lock database. The inherited ACL overrides the 0700 mode that directory is created with, and the privacy check took the result for a directory another process had swapped in. The lock now closes a freshly created, empty link directory to its owner through its open descriptor before using it. A same-account directory that already has content is still refused as swapped in, and one owned by another account is refused as before.

Behavior by aclmode

Fixes #897

An inherited NFSv4 ACL on ZFS gives the mkdtemp link directory group
access, which the private-mode check read as a swapped-in directory, so
every acquire in such a directory failed. An empty link directory is now
chmod 0700 through its descriptor; one that stays open, as under
aclmode=restricted, fails with an error naming the fix.

Fixes tox-dev#897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReadWriteLock fails with "link directory ... was replaced while opening" on NFSv4-ACL filesystems

1 participant