diff --git a/container/container_unix.go b/container/container_unix.go index 09d3d23b6c..2a4e29f013 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -174,8 +174,8 @@ func (container *Container) HasMountFor(path string) bool { return false } -// UnmountIpcMount uses the provided unmount function to unmount shm if it was mounted -func (container *Container) UnmountIpcMount(unmount func(pth string) error) error { +// UnmountIpcMount unmounts shm if it was mounted +func (container *Container) UnmountIpcMount() error { if container.HasMountFor("/dev/shm") { return nil } @@ -189,10 +189,8 @@ func (container *Container) UnmountIpcMount(unmount func(pth string) error) erro if shmPath == "" { return nil } - if err = unmount(shmPath); err != nil && !os.IsNotExist(err) { - if mounted, mErr := mount.Mounted(shmPath); mounted || mErr != nil { - return errors.Wrapf(err, "umount %s", shmPath) - } + if err = mount.Unmount(shmPath); err != nil && !os.IsNotExist(err) { + return errors.Wrapf(err, "umount %s", shmPath) } return nil } diff --git a/container/container_windows.go b/container/container_windows.go index b5bdb5bc34..090db12c20 100644 --- a/container/container_windows.go +++ b/container/container_windows.go @@ -22,7 +22,7 @@ const ( // UnmountIpcMount unmounts Ipc related mounts. // This is a NOOP on windows. -func (container *Container) UnmountIpcMount(unmount func(pth string) error) error { +func (container *Container) UnmountIpcMount() error { return nil } diff --git a/daemon/container_operations_unix.go b/daemon/container_operations_unix.go index 9953c7f3fd..5552d09df3 100644 --- a/daemon/container_operations_unix.go +++ b/daemon/container_operations_unix.go @@ -351,10 +351,6 @@ func killProcessDirectly(cntr *container.Container) error { return nil } -func detachMounted(path string) error { - return unix.Unmount(path, unix.MNT_DETACH) -} - func isLinkable(child *container.Container) bool { // A container is linkable only if it belongs to the default network _, ok := child.NetworkSettings.Networks[runconfig.DefaultDaemonNetworkMode().NetworkName()] diff --git a/daemon/container_operations_windows.go b/daemon/container_operations_windows.go index 349d3a1566..10bfd53d6e 100644 --- a/daemon/container_operations_windows.go +++ b/daemon/container_operations_windows.go @@ -78,10 +78,6 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error { return nil } -func detachMounted(path string) error { - return nil -} - func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) { if len(c.SecretReferences) == 0 { return nil diff --git a/daemon/start.go b/daemon/start.go index c00bd9ceb2..f8a0dbf20f 100644 --- a/daemon/start.go +++ b/daemon/start.go @@ -216,7 +216,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint func (daemon *Daemon) Cleanup(container *container.Container) { daemon.releaseNetwork(container) - if err := container.UnmountIpcMount(detachMounted); err != nil { + if err := container.UnmountIpcMount(); err != nil { logrus.Warnf("%s cleanup: failed to unmount IPC: %s", container.ID, err) }