Repository navigation
fix(dir): recount the parent's links when a mkdir or rmdir write fails - #186
Merged
Merged
Conversation
mkdir and rmdir write the parent's inode, carrying the link count change, before the entry's chunk. When the chunk write failed with EIO, the count stayed changed without the entry, and the failed operation closed its intent, so replay never fixed it. Main CI's EIO sweep hit this in group 2. Now a failed add or remove whose inode write carried a parent update recounts the parent from its entries, under the locks it already holds. 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.
Fixes the main CI flake in
TestOneFailedWriteKeepsAcknowledgedResults(Unit Tests group 2, on 125d4ae): "inode 2: directory has 3 links, want 2".mkdir and rmdir write the parent's inode, carrying the link-count change, before the entry's chunk. If the chunk write fails with EIO, the count stays changed without the entry. The failed operation closes its intent, so replay never fixes it. This wasn't new in #181: before #181 the separate parent update could fail the same way, and #181's warning made it visible.
Now, when an add or remove fails after an inode write that carried a parent update, it recounts the parent from its entries under the locks it already holds.
The new tests fail each write of one mkdir or rmdir in turn, with no crash, and check the root's link count. They fail on main and pass here.
Verified on .68: lint, unit,
-raceon goclusterfs,-shortintegration (150 pass, 0 fail), parity, andGOCLUSTERFS_EIO_SWEEP=metadataon the EIO sweep and the new tests.Not covered here: rename completes its intent even when
dir.Renamefails after its journal commit. So an EIO partway through a rename leaves a partial rename that replay never finishes. That needs its own fix.🤖 Generated with Claude Code