فهرست منبع

Use lazy unmount for local volume unmount

This is a spiritual backport of acbfe6bc56b9357d40a452f6b3901cb2c2d40404
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>
Brian Goff 8 سال پیش
والد
کامیت
2dfb31c228
4فایلهای تغییر یافته به همراه22 افزوده شده و 1 حذف شده
  1. 1 1
      volume/local/local.go
  2. 7 0
      volume/local/unmount_linux.go
  3. 9 0
      volume/local/unmount_unix.go
  4. 5 0
      volume/local/unmount_windows.go

+ 1 - 1
volume/local/local.go

@@ -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)
 			}

+ 7 - 0
volume/local/unmount_linux.go

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

+ 9 - 0
volume/local/unmount_unix.go

@@ -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)
+}

+ 5 - 0
volume/local/unmount_windows.go

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