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_dir_ops.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/fusefrontend/file_dir_ops.go') diff --git a/internal/fusefrontend/file_dir_ops.go b/internal/fusefrontend/file_dir_ops.go index b69e7bc..683da87 100644 --- a/internal/fusefrontend/file_dir_ops.go +++ b/internal/fusefrontend/file_dir_ops.go @@ -154,7 +154,7 @@ func (f *File) Readdirent(ctx context.Context) (entry *fuse.DirEntry, errno sysc if err != nil { tlog.Warn.Printf("Readdirent: incomplete entry %q: Could not read .name: %v", cName, err) - f.rootNode.reportMitigatedCorruption(cName) + reportMitigatedCorruption(ctx, cName) continue } cName = cNameLong @@ -166,7 +166,7 @@ func (f *File) Readdirent(ctx context.Context) (entry *fuse.DirEntry, errno sysc if err != nil { tlog.Warn.Printf("Readdirent: could not decrypt entry %q: %v", cName, err) - f.rootNode.reportMitigatedCorruption(cName) + reportMitigatedCorruption(ctx, cName) continue } // Override the ciphertext name with the plaintext name but reuse the rest -- cgit v1.2.3