Browse code

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 authored on 2017/05/10 03:17:10
Showing 4 changed files
... ...
@@ -353,7 +353,7 @@ func (v *localVolume) Unmount(id string) error {
353 353
 
354 354
 func (v *localVolume) unmount() error {
355 355
 	if v.opts != nil {
356
-		if err := mount.Unmount(v.path); err != nil {
356
+		if err := unmount(v.path); err != nil {
357 357
 			if mounted, mErr := mount.Mounted(v.path); mounted || mErr != nil {
358 358
 				return errors.Wrapf(err, "error while unmounting volume path '%s'", v.path)
359 359
 			}
360 360
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+package local
1
+
2
+import "golang.org/x/sys/unix"
3
+
4
+func unmount(path string) error {
5
+	return unix.Unmount(path, unix.MNT_DETACH)
6
+}
0 7
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+// +build !linux,!windows
1
+
2
+package local
3
+
4
+import "golang.org/x/sys/unix"
5
+
6
+func unmount(path string) error {
7
+	return unix.Unmount(path, 0)
8
+}
0 9
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+package local
1
+
2
+func unmount(_ string) error {
3
+	return nil
4
+}