Skip to content

fix: check ignored errors in dir and fsck; enforce errcheck there - #114

Merged
mattmattox merged 3 commits into
mainfrom
claude/errcheck-dir-fsck
Nov 13, 2026
Merged

mattmattox merged 3 commits into
mainfrom
claude/errcheck-dir-fsck

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes all 57 errcheck findings in internal/dir, internal/fsck and cmd/fsck. 341 findings remain elsewhere.

Config change: errcheck is now on everywhere. Each path that still has findings has its own exclusion rule in .golangci.yml: api, cache, fileops, goclusterfs, sfb, cmd/gfsctl, cmd/mount, tests/benchmark and tests/integration. The old single path-except regex made every errcheck PR edit the same line, which is why #116 and #117 conflict now. From here on, a PR deletes its own rule, and the rules are separated by blank lines so those deletions merge cleanly. New packages get errcheck automatically.

Ignored errors that could hide corruption or loss:

Smaller fixes:

  • Leaked dir block: when dir.addToNewBlock can't free its unused block on cleanup, it now logs that the block stays allocated with no owner. fsck -repair frees such blocks (feat(fsck): free leaked blocks in -repair #72).
  • CLI output: -list-slots and -release-slot return the first failed write. A failed device close is reported on stderr. fsck's verbose progress output discards write errors explicitly.

Merged with main: after #112 and #97. The two dir.go conflicts with #97 are resolved: #97's logging.Debugf lines are kept, and all lock releases still go through unlock. #97's new packages have no errcheck findings.

🤖 Generated with Claude Code

- dir dropped the error from releasing a directory's inode lock in 12
  places. ErrNotLockOwner means a double release, which may have dropped
  another holder's lock early so two writers rewrote the same directory
  block and lost entries. It is now logged as an error; other release
  failures log a warning.
- dir logs a block that addToNewBlock could not free on cleanup; it
  stays allocated with no owner until fsck -repair frees it.
- goclusterfs-fsck -list-slots and -release-slot return the first
  failed write. -release-slot no longer releases a slot whose plan it
  could not print. A failed device close is reported on stderr.
- fsck's verbose progress output discards write errors explicitly.
- Tests check setup steps and discard cleanup errors explicitly.

errcheck now also covers internal/dir, internal/fsck and cmd/fsck; 341
findings remain elsewhere.

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