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:
parent
6aac9ab3c7
commit
2dfb31c228
4 changed files with 22 additions and 1 deletions
|
@ -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
volume/local/unmount_linux.go
Normal file
7
volume/local/unmount_linux.go
Normal 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)
|
||||
}
|
9
volume/local/unmount_unix.go
Normal file
9
volume/local/unmount_unix.go
Normal 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)
|
||||
}
|
5
volume/local/unmount_windows.go
Normal file
5
volume/local/unmount_windows.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package local
|
||||
|
||||
func unmount(_ string) error {
|
||||
return nil
|
||||
}
|
Loading…
Reference in a new issue