diff options
| author | Jakob Unterwurzacher | 2026-11-19 20:53:14 +0100 |
|---|---|---|
| committer | Jakob Unterwurzacher | 2026-11-19 21:16:19 +0100 |
| commit | 52c4864d849cbbb76d49d1a908025b77c7246bda (patch) | |
| tree | 265f05f143e2129a18359165832e367cfba47c11 /internal/fusefrontend/file_allocate_truncate.go | |
| parent | 43e17fc6488ac088b51758a81dbc039f7c158f6a (diff) | |
fusefrontend: report mitigated corruptions via the context
Replace the RootNode.MitigatedCorruptions channel with a callback that
fsck attaches to the context of each operation via
fusefrontend.WithCorruptionReporter().
The channel was needed when fsck went through the kernel, but now that
fsck calls the node operations directly, the context is a better way:
* Each report is attributed to the operation that caused it, so fsck
no longer needs a watcher goroutine and the watchDone channel around
every call.
* reportMitigatedCorruption() no longer blocks for up to one second
(and logs "BUG: reportCorruptItem: timeout") when nobody is listening.
* A mounted filesystem has no reporter in the context, so reporting is
a no-op there.
readFileID() and doRead() now take a ctx. The write paths pass
context.Background(), as fsck never writes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/fusefrontend/file_allocate_truncate.go')
| -rw-r--r-- | internal/fusefrontend/file_allocate_truncate.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go index b7b2651..19b7697 100644 --- a/internal/fusefrontend/file_allocate_truncate.go +++ b/internal/fusefrontend/file_allocate_truncate.go @@ -179,7 +179,7 @@ func (f *File) truncate(newSize uint64) (errno syscall.Errno) { lastBlockLen := newSize - plainOff var data []byte if lastBlockLen > 0 { - data, errno = f.doRead(nil, plainOff, lastBlockLen) + data, errno = f.doRead(context.Background(), nil, plainOff, lastBlockLen) if errno != 0 { tlog.Warn.Printf("Truncate: shrink doRead returned error: %v", err) return errno |
