Use lazy unmount for local volume unmount

This is a spiritual backport of acbfe6bc56
The afformentioned commit was not cherry-picked because it is a broader
change to the codebase, whereas this is the same basic fix but localized
to the local volume driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2017-05-09 14:17:10 -04:00
parent 6aac9ab3c7
commit 2dfb31c228
4 changed files with 22 additions and 1 deletions

View file

@ -353,7 +353,7 @@ func (v *localVolume) Unmount(id string) error {
func (v *localVolume) unmount() error {
if v.opts != nil {
if err := mount.Unmount(v.path); err != nil {
if err := unmount(v.path); err != nil {
if mounted, mErr := mount.Mounted(v.path); mounted || mErr != nil {
return errors.Wrapf(err, "error while unmounting volume path '%s'", v.path)
}

View file

@ -0,0 +1,7 @@
package local
import "golang.org/x/sys/unix"
func unmount(path string) error {
return unix.Unmount(path, unix.MNT_DETACH)
}

View file

@ -0,0 +1,9 @@
// +build !linux,!windows
package local
import "golang.org/x/sys/unix"
func unmount(path string) error {
return unix.Unmount(path, 0)
}

View file

@ -0,0 +1,5 @@
package local
func unmount(_ string) error {
return nil
}