summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-10 17:01:41 -0400
committerGitHub <noreply@github.com>2021-06-10 17:01:41 -0400
commit0c38ac44efcaa83f98c727408fbba78456f9edd8 (patch)
tree8d483c3abfe676062f10fd6297ca7239f59d168e /libpod/container.go
parent6feaae699d70191071595716a383bbd48793a81a (diff)
parent3b6cb8fabb2695df6518ee598abb945044afc758 (diff)
downloadpodman-0c38ac44efcaa83f98c727408fbba78456f9edd8.tar.gz
podman-0c38ac44efcaa83f98c727408fbba78456f9edd8.tar.bz2
podman-0c38ac44efcaa83f98c727408fbba78456f9edd8.zip
Merge pull request #10609 from giuseppe/ignore-named-hierarchies
container: ignore named hierarchies
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index c6f0cd618..4b9bea5fc 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -957,6 +957,12 @@ func (c *Container) cGroupPath() (string, error) {
// is the libpod-specific one we're looking for.
//
// See #8397 on the need for the longest-path look up.
+ //
+ // And another workaround for containers running systemd as the payload.
+ // containers running systemd moves themselves into a child subgroup of
+ // the named systemd cgroup hierarchy. Ignore any named cgroups during
+ // the lookup.
+ // See #10602 for more details.
procPath := fmt.Sprintf("/proc/%d/cgroup", c.state.PID)
lines, err := ioutil.ReadFile(procPath)
if err != nil {
@@ -972,6 +978,10 @@ func (c *Container) cGroupPath() (string, error) {
logrus.Debugf("Error parsing cgroup: expected 3 fields but got %d: %s", len(fields), procPath)
continue
}
+ // Ignore named cgroups like name=systemd.
+ if bytes.Contains(fields[1], []byte("=")) {
+ continue
+ }
path := string(fields[2])
if len(path) > len(cgroupPath) {
cgroupPath = path