From d6558ad6a4552fc745e893f93ae190710d1a36bc Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 10 May 2018 16:47:12 -0400 Subject: [PATCH] Use mount package to unmount container stuff Really these mounts shouldn't be in the container pacakge. Signed-off-by: Brian Goff --- container/container_linux.go | 9 --------- container/container_notlinux.go | 23 ----------------------- container/container_unix.go | 4 ++-- 3 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 container/container_linux.go delete mode 100644 container/container_notlinux.go diff --git a/container/container_linux.go b/container/container_linux.go deleted file mode 100644 index ea2ebabaaa..0000000000 --- a/container/container_linux.go +++ /dev/null @@ -1,9 +0,0 @@ -package container // import "github.com/docker/docker/container" - -import ( - "golang.org/x/sys/unix" -) - -func detachMounted(path string) error { - return unix.Unmount(path, unix.MNT_DETACH) -} diff --git a/container/container_notlinux.go b/container/container_notlinux.go deleted file mode 100644 index dc9751b8c7..0000000000 --- a/container/container_notlinux.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build freebsd - -package container // import "github.com/docker/docker/container" - -import ( - "golang.org/x/sys/unix" -) - -func detachMounted(path string) error { - // FreeBSD do not support the lazy unmount or MNT_DETACH feature. - // Therefore there are separate definitions for this. - return unix.Unmount(path, 0) -} - -// SecretMounts returns the mounts for the secret path -func (container *Container) SecretMounts() []Mount { - return nil -} - -// UnmountSecrets unmounts the fs for secrets -func (container *Container) UnmountSecrets() error { - return nil -} diff --git a/container/container_unix.go b/container/container_unix.go index 9397cdf60b..c77ea07a18 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -1,4 +1,4 @@ -// +build linux freebsd +// +build !windows package container // import "github.com/docker/docker/container" @@ -380,7 +380,7 @@ func (container *Container) DetachAndUnmount(volumeEventLog func(name, action st } for _, mountPath := range mountPaths { - if err := detachMounted(mountPath); err != nil { + if err := mount.Unmount(mountPath); err != nil { logrus.Warnf("%s unmountVolumes: Failed to do lazy umount fo volume '%s': %v", container.ID, mountPath, err) } }