From ac39a95ea618601f78662972c35838d928858904 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 19 Jan 2018 13:27:05 -0800 Subject: [PATCH] volume/local: call umount unconditionally There is no need to parse mount table and iterate through the list of mounts, and then call Unmount() which again parses the mount table and iterates through the list of mounts. It is totally OK to call Unmount() unconditionally. Signed-off-by: Kir Kolyshkin --- volume/local/local.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/volume/local/local.go b/volume/local/local.go index 3eee5a92f9..226a5dd4fb 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -19,7 +19,6 @@ import ( "github.com/docker/docker/pkg/mount" "github.com/docker/docker/volume" "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // VolumeDataPathName is the name of the directory where the volume data is stored. @@ -66,11 +65,6 @@ func New(scope string, rootIDs idtools.IDPair) (*Root, error) { return nil, err } - mountInfos, err := mount.GetMounts(nil) - if err != nil { - logrus.Debugf("error looking up mounts for local volume cleanup: %v", err) - } - for _, d := range dirs { if !d.IsDir() { continue @@ -96,12 +90,7 @@ func New(scope string, rootIDs idtools.IDPair) (*Root, error) { } // unmount anything that may still be mounted (for example, from an unclean shutdown) - for _, info := range mountInfos { - if info.Mountpoint == v.path { - mount.Unmount(v.path) - break - } - } + mount.Unmount(v.path) } }