From 52c4864d849cbbb76d49d1a908025b77c7246bda Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 19 Nov 2026 20:53:14 +0100 Subject: 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 --- internal/fusefrontend/file_allocate_truncate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/fusefrontend/file_allocate_truncate.go') 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 -- cgit v1.2.3