Repository navigation
fix(fs): remove a name only while it names the looked-up inode, and replay mkdir and claimed creates whole - #94
Merged
Merged
Conversation
Unlink and rmdir looked up the child, then removed the name and freed the child by that lookup. If another node removed the name and made a new one in between, they removed the new name and freed with stale extents. The removal now checks the child under the directory lock: a name that points to another inode returns ENOENT, and a changed child is looked up again. The free uses what the inode maps when it is freed. Name errors map to EEXIST and ENOENT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anded A replayed mkdir now gets "." and ".." and raises the parent's link count, under the parent's inode lock. A create that crashed after claiming its inode used to leave it unnamed: replay now names it when the logging node wrote it last, and no more often than a create does before naming it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… name errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… directories Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every write raises a file's generation, so unlink of a file another node kept writing ran out of retries with EAGAIN. A file now only has to keep its type and link count; a directory still has to be unchanged, since an entry added to it changes its generation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The four follow-ups from #84, in the PM's order.
Unlink and rmdir looked up the child, then removed the name and freed the child as the lookup saw it. If another node removed the name and made a new one in between, they removed the new name and freed it with stale extents.
RemoveIfnow checks the entry under the directory lock:FreeIfsees it under the inode lock, not the lookup's copy.There is no rename.
Replayed mkdir now gets "." and "..", a link count of 2, and raises the parent's link count. The parent update uses the new
inode.Table.Update, which holds the inode lock from the read to the write. A plain read followed byWritecould overwrite a peer's directory change.Name errors in create, mkdir, clone, unlink and rmdir: EEXIST for a taken name, ENOENT for a removed directory.
Replay finishes a claimed create. When the slot is in use, replay names it if the transaction's owner wrote it last, and at most as often as a create does before naming (2 writes for a file, 3 for a directory). Nothing else can reach an unnamed inode. A finished create also passes this check, but its name already exists, so the add is skipped.
Not covered
Results
-short138/0.🤖 Generated with Claude Code