cgroups: do not create $ROOT/pids on cgroupv2

add the same check we already have for other controllers, since
`createCgroupDirectory` is meant to be used on cgroup v1 only.

Closes: https://github.com/containers/common/issues/862

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-12-23 09:04:30 +01:00
parent 463f91ec52
commit e8532febce
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@ func (c *pidHandler) Apply(ctr *CgroupControl, res *spec.LinuxResources) error {
// Create the cgroup
func (c *pidHandler) Create(ctr *CgroupControl) (bool, error) {
if ctr.cgroup2 {
return false, nil
}
return ctr.createCgroupDirectory(Pids)
}