diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-10-04 07:30:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-04 07:30:27 -0700 |
commit | c9e936a40796824422011515f2fe445f93451f31 (patch) | |
tree | fdab943f3efda62d030e42f7347cf02d7caa3943 /libpod/util_linux.go | |
parent | 1fe955600979f54ada204afa6c357fd094d6f549 (diff) | |
parent | dacbc5beb2a8841e52cf8ea7f544b4d302469c1d (diff) | |
download | podman-c9e936a40796824422011515f2fe445f93451f31.tar.gz podman-c9e936a40796824422011515f2fe445f93451f31.tar.bz2 podman-c9e936a40796824422011515f2fe445f93451f31.zip |
Merge pull request #3549 from marcov/evict-container
Add ability to evict a container
Diffstat (limited to 'libpod/util_linux.go')
-rw-r--r-- | libpod/util_linux.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/util_linux.go b/libpod/util_linux.go index d5c113daf..631f6836c 100644 --- a/libpod/util_linux.go +++ b/libpod/util_linux.go @@ -5,6 +5,7 @@ package libpod import ( "fmt" "strings" + "syscall" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/pkg/cgroups" @@ -12,6 +13,7 @@ import ( "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" "github.com/sirupsen/logrus" + "golang.org/x/sys/unix" ) // systemdSliceFromPath makes a new systemd slice under the given parent with @@ -107,3 +109,14 @@ func LabelVolumePath(path string, shared bool) error { } return nil } + +// Unmount umounts a target directory +func Unmount(mount string) { + if err := unix.Unmount(mount, unix.MNT_DETACH); err != nil { + if err != syscall.EINVAL { + logrus.Warnf("failed to unmount %s : %v", mount, err) + } else { + logrus.Debugf("failed to unmount %s : %v", mount, err) + } + } +} |