Repository navigation
fix(fs): keep other nodes' changes when setattr writes an inode - #102
Merged
Merged
Conversation
chmod, chown and utimes on a directory read and wrote its inode without the cluster lock, so a create or mkdir on another node in between lost its link count and mtime. They now hold the inode lock from read to write. File setattr had the same gap: an append inside an allocated block on another node changes the size but not the extents, so the stale-extent check let setattr write the old size back. It now writes only if the inode's generation is unchanged since its read, and retries otherwise. It cannot hold the inode lock across a truncate, which allocates tree blocks. 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.
Found while checking whether #84 fixed the root create write-back (it did).
chmod/chown/utimeson a directory wrote back a stale inode, losing another node's concurrent create or mkdir (link count, mtime). It now usesupdateInodeLocked.Table.WriteIfUnchanged) and retries otherwise. It can't hold the inode lock across a truncate, which allocates tree blocks.TestDirSetattrKeepsOtherNodesMkdirTestFileSetattrKeepsOtherNodesSizemake lint; unit tests;-raceon inode and goclusterfsIntegration tests weren't run locally: another session held the .68 host lock.
🤖 Generated with Claude Code