Skip to content

feat(fsck): check ".", and repair a wrong "." or ".." - #190

Merged
mattmattox merged 1 commit into
mainfrom
fix-fsck-dot-entries
Nov 17, 2026
Merged

mattmattox merged 1 commit into
mainfrom
fix-fsck-dot-entries

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

#181 already reports a wrong .., with both inode numbers, and .. loops. Two parts were missing: . was never checked (its case "." was empty), and repair left directories alone.

Phase 6 now reports a missing . or one that names another inode. Repair:

  • points a wrong . at the directory itself;
  • points a wrong .. at the directory that names it, found by walking the names down from the root;
  • leaves .. alone when the directory has more than one name or the walk doesn't reach it;
  • changes an entry only if it still names the inode phase 6 read (dir.PointIf).

Missing entries are reported, not added. -dry-run writes nothing.

The test uses a real rename (p1/d to p2/e), then puts .. back at p1 and points p2's . at p1. It checks the dry run, the repair, and a clean check after. It fails on main. fsck and the full goclusterfs suite pass on .66. The docs no longer say repair never edits directories.

🤖 Generated with Claude Code

Phase 6 recorded ".." but not ".", so a "." naming another inode, or
none at all, went unreported. It now reports both, with the inode
numbers.

Repair now points a wrong "." at the directory itself and a wrong ".."
at the directory that names it, found by walking the names down from
the root. It leaves ".." alone when the directory has more than one
name or the walk does not reach it, and changes an entry only if it
still names the inode phase 6 read. A missing entry is reported but not
added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 8a583fe into main Nov 17, 2026
18 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