Skip to content

feat(fsck): free inodes no directory names in -repair - #86

Merged
mattmattox merged 1 commit into
mainfrom
feat/fsck-repair-free-unnamed-inodes
Nov 13, 2026
Merged

mattmattox merged 1 commit into
mainfrom
feat/fsck-repair-free-unnamed-inodes

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Repair now frees unnamed inodes (left behind when replay skips an unlink's records, as in #80) through the runtime's inode.Table.Free and extent.Manager.Delete with refcounts set, so clone and snapshot blocks lose one owner and stay allocated. There is no lost+found, so a freed file's data is gone; the docs say to read -dry-run first.

Behaviour changes: . and .. no longer count as names, so unnamed directories are found. Each unnamed inode is reported once, in phase 8, instead of in phases 6 and 8. A snapshot data inode that no snapshot refers to is freed too. Freeing an empty unnamed directory can leave its old parent's link count one too high, because the parent still counts the freed directory's ... fsck does not check or fix directory link counts.

Tested on .66 at 50276ce: race unit tests for fsck and goclusterfs pass, integration -short 119 passed and 0 failed, lint 0 issues, parity passes. A mutation check per keep rule and gate (9 in total) makes a test fail. The replay tests take about 16 s each, like the existing crash tests, because of the 15 s dead-node lock takeover.

🤖 Generated with Claude Code

Replay leaves an inode without a name when it skips an unlink's
ExtentFree and InodeDelete, for example after another node wrote a file
that was unlinked while open there. Phase 8 now reports each such inode
once, and repair frees it the way unlink does: the inode first, then its
blocks through the runtime's extent manager and refcounts, so a block a
clone or snapshot also maps only loses one owner.

Repair keeps reserved inodes, inodes a snapshot refers to, directories
that are not empty and files that map small-file slots. It keeps all of
them when a directory, inode or snapshot descriptor cannot be read, when
a phase it needs did not finish, or when a journal needs replay. "." and
".." no longer count as names, so an unnamed directory is found too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 84c0be6 into main Nov 13, 2026
13 checks passed
mattmattox added a commit that referenced this pull request Nov 13, 2026
* fix(broadcast): count multicast failures in a row and retry after a pause

The failure counter never reset, so after 3 failed multicast sends in
total over a mount, a node sent invalidations only to unicast peers
until it unmounted. Now a successful send resets the count, and after
MaxMulticastFailures failures in a row the node sends only to unicast
peers for 30 seconds before it tries multicast again. The total stays
in TransportStats; /metrics does not export broadcast counters.

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

* refactor(journal): remove the unused FullThreshold setting

Nothing read it. A checkpoint already runs every 5 seconds and is
forced when a transaction does not fit.

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

* fix(mount): log that SFB is disabled and stop creating its unused manager

-sfb defaulted to true and logged "SFB: enabled", but nothing used the
SFB manager it created: writes never allocate slots, and reading,
migrating and freeing old slots does not go through it. Mount now logs
what is in effect and still accepts -sfb.

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

* chore: raise the integration test timeout and fix stale help text

make test-integration ran the full suite with a 5 minute timeout; it
takes about 15 minutes, so allow 30 and say so in make help.

goclusterfs-fsck -h said repair never frees blocks or deletes inodes,
which changed with #72 and #86, and the api package doc called the API
read-only, which changed with #57.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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