Repository navigation
fix(fs): claim a new inode before naming it, and check replayed entry changes under the directory lock - #84
Merged
Merged
Conversation
The root copies had drifted: a directory made in the root kept a link count of 1 instead of 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Create, mkdir and clone added the name first. A crash before the claim left a name pointing at a free slot; the next node to claim that slot gave its new inode a second name. Claiming first, a crash can only leak an unnamed inode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replay looked up an entry, then added or removed it in a separate locked step, so a peer could change the entry in between. RemoveIf checks the entry under the lock, and Add and Remove now refuse a directory another node removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es under replay's check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sts in the manifest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
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.
Create, mkdir and clone added the name before claiming the inode slot. A crash in between left a name for a free slot, and the next node to claim that slot gave its inode a second name. They now claim first. A crash in between leaks an unnamed inode, which fsck reports as an orphan.
The first commit merges the root and subdirectory copies of create and mkdir, so the order changes in one place. The copies had drifted: mkdir in the root left a link count of 1.
Replay's entry checks now run under the directory lock. DirRemoveEntry uses the new
RemoveIf. DirAddEntry relies onAdd, which already refused an existing name under the lock, so noAddIfwas needed.AddandRemovenow also refuse a directory another node removed (ErrRemoved). Before,Addon a removed directory returned success.Not covered
ErrRemovedhas no test: it needs a peer to remove the parent insideAdd's lock window.Results at 83e114b (the later commit only shortens comments)
-short138/0.RemoveIf's lock, dropping the removed-directory check, or breaking either replay check makes a test fail.🤖 Generated with Claude Code