Skip to content

Commit

Permalink
chunker: fix finalizer already set error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nielash committed Apr 29, 2024
1 parent f50bdc5 commit b56d330
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions backend/chunker/chunker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit b56d330

Please sign in to comment.