summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-02-10 19:33:34 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-02-12 09:53:33 +0100
commit5bae803757e008a959790bc4489c71fe446edb7c (patch)
tree233c9f133a7af553719a20e54e30040ef80bc792
parentf13f53d6e1e52cff83168814a96c376178360ea3 (diff)
downloadpodman-5bae803757e008a959790bc4489c71fe446edb7c.tar.gz
podman-5bae803757e008a959790bc4489c71fe446edb7c.tar.bz2
podman-5bae803757e008a959790bc4489c71fe446edb7c.zip
utils: ignore unified on cgroupv1 if not present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> (cherry picked from commit 9196a5ce36a559cc0d10230194f93a61b40e870a)
-rw-r--r--utils/utils_supported.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/utils_supported.go b/utils/utils_supported.go
index dfa0b486a..9a1c82ee6 100644
--- a/utils/utils_supported.go
+++ b/utils/utils_supported.go
@@ -150,6 +150,11 @@ func moveUnderCgroup(cgroup, subtree string, processes []uint32) error {
// If it is not using unified mode, the cgroup v2 hierarchy is
// usually mounted under /sys/fs/cgroup/unified
cgroupRoot = filepath.Join(cgroupRoot, "unified")
+
+ // Ignore the unified mount if it doesn't exist
+ if _, err := os.Stat(cgroupRoot); err != nil && os.IsNotExist(err) {
+ continue
+ }
} else if parts[1] != "" {
// Assume the controller is mounted at /sys/fs/cgroup/$CONTROLLER.
controller := strings.TrimPrefix(parts[1], "name=")