fix: fsmount data loss, deadlock, and locking bugs - #10
Open
childish-sambino wants to merge 4 commits into
Open
Conversation
…e bits on Windows
childish-sambino
marked this pull request as ready for review
July 7, 2026 22:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes from an audit of the fsmount package, one commit each:
time.Since(zero)exceeded every timeout and the sweeper cancelled live sessions, deleting their working copies, on its first 10-minute tick. Silent data loss for any file held open for write across a tick.flags.IsReadOnlycompared the whole flag word to zero. Linux forces O_LARGEFILE (0x8000) into every open from 64-bit userspace, so all read opens were classified as writes: reading a file without thewpermission returned EACCES, and every read open acquired an exclusive remote lock. It now masks the POSIX access mode plus write-implying bits (O_CREAT, O_TRUNC, O_APPEND).RemoteFs.DestroyheldlockMapMutexwhile callingunlock, which re-acquires the same mutex. Unmounting with any held file lock deadlocked. It now snapshots the map before unlocking.listDirreadlockMapwithout the mutex, racing lock acquisition on another FUSE dispatch thread (fatal concurrent map read and write).LocalFs.Getattrlstat'd the raw FUSE path instead of the sandbox path (fqwas computed but only logged), so locally-stored files always returned ENOENT. The darwin twin already usedfq.LocalFs.Getattremitted Go FileMode bits instead of POSIX S_IFMT, so locally-stored directories were reported withS_IFMT == 0and Explorer treated them as zero-type files.This package needs fuse.h to compile, which my machine doesn't have, so verification here was
GOOS=windows go build/go vet(clean) plus a new IsReadOnly test case that needs CI to execute.🤖 Generated by Quad tha God