Repository navigation
fix(fsck): report sharing past the refcount table - #44
Merged
Merged
Conversation
The 1 MB refcount table has entries for blocks 0-130815, but phase 5 only checked entries inside it. On larger volumes a block past the table that several inodes share with counts reads as having one owner, so deleting one of them frees it while the others still map it. fsck missed this, and repair marked older uncounted sharing of such blocks counted, which turns "never freed" into "freed on the first release". fsck now warns when the volume has more blocks than the table covers, reports such multiply mapped blocks as Critical, and reports inodes with older sharing past the table without marking them counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The write path decides copy-on-write from the refcount, which reads 0 past the table, so a write to one file of such older sharing changes the others. Repair cannot count those blocks, so report the inode as an error and tell the user to copy the file apart. 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.
Follow-up to #39, from its review. On volumes over about 128 GiB, fsck could not see sharing that the refcount table has no counts for. Repair also made it worse.
Against main's fsck, the new test shows three gaps on a 200 GiB image:
-repairmarks old uncounted sharing of block 130825 counted, so its first release frees it.Now fsck warns about the coverage gap and reports Critical for each such block, capped at 10 like phase 8. Repair leaves old sharing past the table uncounted, which means never freed. Those inodes are reported as Error (exit 4): writes to one file change the others, because copy-on-write reads a count of 0 past the table. The fix is to copy the file and delete the original.
This doesn't depend on #39's code, and merges cleanly with it in either order.
🤖 Generated with Claude Code