summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2020-05-12 14:32:00 -0400
committerPeter Hunt <pehunt@redhat.com>2020-05-12 15:36:33 -0400
commitf4b59c74a799a27d74ea23aca4e61df787b80647 (patch)
treee0fc69a881be3e2d66d0507dff850325a11788b2 /pkg
parent5b4e91db73a80f31f67b7c28832527e64b074b74 (diff)
downloadpodman-f4b59c74a799a27d74ea23aca4e61df787b80647.tar.gz
podman-f4b59c74a799a27d74ea23aca4e61df787b80647.tar.bz2
podman-f4b59c74a799a27d74ea23aca4e61df787b80647.zip
cgroup: skip unified if we are using v1
There exists a chance for a node to be booted in v1, but have reminents of v2. An example is this CRI-O ci run: https://deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gcs/origin-federated-results/pr-logs/pull/cri-o_cri-o/3565/test_pull_request_crio_critest_fedora/11243/ We fail because we are incorrectly writing to the unified path, because we are v1. We should not write to the unified path if we are v1 Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/cgroups/cgroups.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index d51905f4b..3b56f944f 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -517,6 +517,10 @@ func (c *CgroupControl) AddPid(pid int) error {
}
for _, n := range names {
+ // If we aren't using cgroup2, we won't write correctly to unified hierarchy
+ if !c.cgroup2 && n == "unified" {
+ continue
+ }
p := filepath.Join(c.getCgroupv1Path(n), "tasks")
if err := ioutil.WriteFile(p, pidString, 0644); err != nil {
return errors.Wrapf(err, "write %s", p)