summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDoug Rabson <dfr@rabson.org>2022-09-20 11:30:12 +0100
committerDoug Rabson <dfr@rabson.org>2022-09-27 16:31:40 +0100
commitabe8dad3449b38dee845358d0da5ababa8d8c157 (patch)
tree8537ceb8f92ec577af007bdddc16965389fced43 /libpod
parent9de2a5ff795f25da0d887304db3559d06832caef (diff)
downloadpodman-abe8dad3449b38dee845358d0da5ababa8d8c157.tar.gz
podman-abe8dad3449b38dee845358d0da5ababa8d8c157.tar.bz2
podman-abe8dad3449b38dee845358d0da5ababa8d8c157.zip
libpod: Factor out usage of unix.MNT_DETACH from (*Volume).unmount
There is an existing wrapper for unix.Unmount(..., MNT_DETACH) in util_linux.go but that filters all errors and for volumes, we only want to filter EINVAL. The existing libpod.Unmount seems to only have one call site so perhaps these can be merged. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/volume_internal_common.go2
-rw-r--r--libpod/volume_internal_linux.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/libpod/volume_internal_common.go b/libpod/volume_internal_common.go
index 440bceec3..c85782e4b 100644
--- a/libpod/volume_internal_common.go
+++ b/libpod/volume_internal_common.go
@@ -180,7 +180,7 @@ func (v *Volume) unmount(force bool) error {
}
// Unmount the volume
- if err := unix.Unmount(v.config.MountPoint, unix.MNT_DETACH); err != nil {
+ if err := detachUnmount(v.config.MountPoint); err != nil {
if err == unix.EINVAL {
// Ignore EINVAL - the mount no longer exists.
return nil
diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go
new file mode 100644
index 000000000..eb4309dc3
--- /dev/null
+++ b/libpod/volume_internal_linux.go
@@ -0,0 +1,9 @@
+package libpod
+
+import (
+ "golang.org/x/sys/unix"
+)
+
+func detachUnmount(mountPoint string) error {
+ return unix.Unmount(mountPoint, unix.MNT_DETACH)
+}