Skip to content

test(fsck): free the blocks interrupted truncates and subdirectory unlinks leave - #75

Merged
mattmattox merged 2 commits into
mainfrom
claude/fsck-reclaim-truncate-test
Nov 12, 2026
Merged

mattmattox merged 2 commits into
mainfrom
claude/fsck-reclaim-truncate-test

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #72, unblocked by #65. It covers the interrupted-free leaks that the reclaim was built for.

  • Truncate: the test stalls the truncate's free on a refcount lock that another node holds. At that point the shorter inode is on disk and the intent is still open. It then simulates a crash by closing the device, and replays the journal.
  • Subdirectory unlink: the same crash in Dir.Unlink of sub/victim.bin, after the entry is removed and before the frees. Replay deletes the inode and frees nothing for BlockFree.

Both tests let replay leave any of the released blocks allocated. Check must name exactly those, -repair must free exactly those, and the allocated set must end up as before minus the released blocks. Today replay leaves blocks 2 and 3 in both tests, and repair frees them. Once per-node-journal makes replay free them, the tests still pass, and repair changes nothing. I checked that with a copy whose replay frees them.

On .66 both tests pass 10/10 with -race. The goclusterfs and fsck packages pass with -race, and lint and parity pass.

🤖 Generated with Claude Code

mattmattox and others added 2 commits November 12, 2026 05:07
A node crashes after a truncate writes the shorter inode but before it
frees the cut blocks. Since #65, replay frees nothing for that record,
so the blocks stay allocated. The test stalls the truncate's free on a
refcount lock another node holds, crashes by closing the device,
replays the journal, and checks that fsck -repair frees exactly the 2
cut blocks and that both files keep their data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y behavior

The truncate test required replay to leave the cut blocks allocated. A
shared helper now accepts whatever of the released blocks replay leaves:
check must name exactly those, repair must free exactly those, and the
allocated set must end as before minus the released blocks. The test
keeps passing once replay frees these blocks itself.

The new test crashes while unlinking a file in a subdirectory, after its
entry is gone and before its blocks are freed. Replay deletes the inode
and frees nothing for the BlockFree record, so the blocks leak until
repair frees them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox mattmattox changed the title test(fsck): free the blocks an interrupted truncate leaves test(fsck): free the blocks interrupted truncates and subdirectory unlinks leave Nov 12, 2026
@mattmattox
mattmattox merged commit 8e1e25e into main Nov 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant