From 9196a5ce36a559cc0d10230194f93a61b40e870a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 10 Feb 2021 19:33:34 +0100 Subject: utils: ignore unified on cgroupv1 if not present Signed-off-by: Giuseppe Scrivano --- utils/utils_supported.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'utils') 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=") -- cgit v1.2.3-54-g00ecf