From 61ab5197913e911a43f67f34a2f64c0645935cbf Mon Sep 17 00:00:00 2001 From: nielash Date: Mon, 29 Apr 2024 03:38:15 -0400 Subject: [PATCH] chunker: fix `finalizer already set` error Before this change, cache.PinUntilFinalized was called twice if the root pointed to a composite multi-chunk file without metadata, resulting in a fatal "finalizer already set" error. This change fixes the issue. --- backend/chunker/chunker.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/chunker/chunker.go b/backend/chunker/chunker.go index fa5bb5987..5fcb0abd3 100644 --- a/backend/chunker/chunker.go +++ b/backend/chunker/chunker.go @@ -308,7 +308,6 @@ func NewFs(ctx context.Context, name, rpath string, m configmap.Mapper) (fs.Fs, root: rpath, opt: *opt, } - cache.PinUntilFinalized(f.base, f) f.dirSort = true // processEntries requires that meta Objects prerun data chunks atm. if err := f.configure(opt.NameFormat, opt.MetaFormat, opt.HashType, opt.Transactions); err != nil { @@ -326,9 +325,9 @@ func NewFs(ctx context.Context, name, rpath string, m configmap.Mapper) (fs.Fs, if testErr == fs.ErrorIsFile { f.base = newBase err = testErr - cache.PinUntilFinalized(f.base, f) } } + cache.PinUntilFinalized(f.base, f) // Correct root if definitely pointing to a file if err == fs.ErrorIsFile {