summaryrefslogtreecommitdiff
path: root/pkg/cgroups/cgroups.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-13 00:21:18 +0200
committerGitHub <noreply@github.com>2019-07-13 00:21:18 +0200
commitc59d08bc77855c0d0d946fa44850a0bf03b102c9 (patch)
tree874d685c5259dad729feac2532137854015eae31 /pkg/cgroups/cgroups.go
parent9d87945005a4870b4f2b7978d73bf37b3fb1faf5 (diff)
parent6c8ceaf21ef0a5af55f62c63295ce930a6db8b8e (diff)
downloadpodman-c59d08bc77855c0d0d946fa44850a0bf03b102c9.tar.gz
podman-c59d08bc77855c0d0d946fa44850a0bf03b102c9.tar.bz2
podman-c59d08bc77855c0d0d946fa44850a0bf03b102c9.zip
Merge pull request #3564 from giuseppe/cgroupsv2-no-controllers-last-path
cgroupsv2: do not enable controllers for the last component
Diffstat (limited to 'pkg/cgroups/cgroups.go')
-rw-r--r--pkg/cgroups/cgroups.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 081db772f..fda19bff8 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -187,8 +187,12 @@ func createCgroupv2Path(path string) (Err error) {
}()
}
}
- if err := ioutil.WriteFile(filepath.Join(current, "cgroup.subtree_control"), resByte, 0755); err != nil {
- return errors.Wrapf(err, "write %s", filepath.Join(current, "cgroup.subtree_control"))
+ // We enable the controllers for all the path components except the last one. It is not allowed to add
+ // PIDs if there are already enabled controllers.
+ if i < len(elements[3:])-1 {
+ if err := ioutil.WriteFile(filepath.Join(current, "cgroup.subtree_control"), resByte, 0755); err != nil {
+ return errors.Wrapf(err, "write %s", filepath.Join(current, "cgroup.subtree_control"))
+ }
}
}
return nil