Repository navigation
fix(fs): open a stale file node as ESTALE, and let O_CREAT open a name made since the lookup - #159
Merged
Merged
Conversation
…e made since the lookup A file node can outlive its inode when another caller unlinks the file or the slot goes to a new inode. File.Open mapped that to EISDIR and Getattr returned the freed inode's attributes. Both now return ESTALE, on which the kernel looks the name up again. The kernel sends CREATE when its lookup found no name. If another node or thread made the name in between, the create failed with EEXIST even without O_EXCL. It now opens the file it finds, honoring O_TRUNC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eeds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # tests/test-manifest.yaml
This was referenced Nov 16, 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.
Two of the history checker's findings (#156), fixed before the unlink-while-open fix lands.
File.Openmapped that to EISDIR (a freed inode has mode 0), andGetattrreturned the freed inode's attributes. Both now return ESTALE, on which Linux redoes the lookup once with revalidation.Getattrstill answers for a file that has links 0 but is in use, because fstat of a descriptor needs that once unlinked-while-open files are kept.open(O_CREAT)withoutO_EXCL. The kernel sends CREATE when its lookup found no name. If another node or thread made the name in between, the create failed with EEXIST. It now opens the file it finds, honoringO_TRUNC.TestStaleFileNodeOpensAsStaleTestCreateWithoutExclOpensTheFileItFinds-racegoclusterfs; integration-short🤖 Generated with Claude Code