From a8924f5da0a8f842ea4afe8556309ebe51b694f8 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Mon, 21 Aug 2023 15:07:59 -0700 Subject: [PATCH] graph/drivers/layer0: fix dropped errors Signed-off-by: Lars Lehtonen --- graph/drivers/layer0/layer0.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/graph/drivers/layer0/layer0.go b/graph/drivers/layer0/layer0.go index c1a7f3d0d..2df641be6 100644 --- a/graph/drivers/layer0/layer0.go +++ b/graph/drivers/layer0/layer0.go @@ -241,7 +241,6 @@ func (l *Layer0) Remove(id string) error { } l.Lock() defer l.Unlock() - var err error v, ok := l.volumes[id] if ok { @@ -253,22 +252,30 @@ func (l *Layer0) Remove(id string) error { if err != nil { logrus.Warnf("Failed in rename(%v): %v", id, err) } - l.Driver.Remove(l.realID(id)) - + err = l.Driver.Remove(l.realID(id)) + if err != nil { + return err + } opts := make(map[string]string) opts[options.OptionsDeleteAfterUnmount] = "true" err = l.volDriver.Unmount(context.TODO(), v.volumeID, v.path, opts) + if err != nil { + return err + } if l.volDriver.Type() == api.DriverType_DRIVER_TYPE_BLOCK { _ = l.volDriver.Detach(context.TODO(), v.volumeID, nil) } err = os.RemoveAll(v.path) + if err != nil { + return err + } delete(l.volumes, v.id) } } else { logrus.Warnf("Failed to find layer0 vol for id %v", id) } - return err + return nil } // Get returns the mountpoint for the layered filesystem