diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-13 00:21:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 00:21:18 +0200 |
commit | c59d08bc77855c0d0d946fa44850a0bf03b102c9 (patch) | |
tree | 874d685c5259dad729feac2532137854015eae31 /pkg/cgroups/cgroups.go | |
parent | 9d87945005a4870b4f2b7978d73bf37b3fb1faf5 (diff) | |
parent | 6c8ceaf21ef0a5af55f62c63295ce930a6db8b8e (diff) | |
download | podman-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.go | 8 |
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 |