From b56fc2d0f8fda5d149d02cc41451fcae4dc834c8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 8 Oct 2020 00:40:47 +0200 Subject: [PATCH] volume/local.New(): don't register volume before we're done Loading options may fail, in which case we don't have to add the volume to the list. Signed-off-by: Sebastiaan van Stijn --- volume/local/local.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volume/local/local.go b/volume/local/local.go index 39bd8bf822..4783d4b858 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -78,7 +78,6 @@ func New(scope string, rootIdentity idtools.Identity) (*Root, error) { path: r.DataPath(name), quotaCtl: r.quotaCtl, } - r.volumes[name] = v if b, err := os.ReadFile(filepath.Join(r.path, name, "opts.json")); err == nil { opts := optsConfig{} if err := json.Unmarshal(b, &opts); err != nil { @@ -93,6 +92,7 @@ func New(scope string, rootIdentity idtools.Identity) (*Root, error) { // unclean shutdown). This is a no-op on windows unmount(v.path) } + r.volumes[name] = v } return r, nil