mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-28 10:01:28 +08:00
cgroupv2: don't use getSubsystemPath in Apply
This code is a copy-paste from cgroupv1 systemd code. Its aim is to check whether a subsystem is available, and skip those that are not. In case v2 unified hierarchy is used, getSubsystemPath never returns "not found" error, so calling it is useless. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -38,14 +38,6 @@ func (m *UnifiedManager) Apply(pid int) error {
|
|||||||
if c.Paths != nil {
|
if c.Paths != nil {
|
||||||
paths := make(map[string]string)
|
paths := make(map[string]string)
|
||||||
for name, path := range c.Paths {
|
for name, path := range c.Paths {
|
||||||
_, err := getSubsystemPath(m.Cgroups, name)
|
|
||||||
if err != nil {
|
|
||||||
// Don't fail if a cgroup hierarchy was not found, just skip this subsystem
|
|
||||||
if cgroups.IsNotFound(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
paths[name] = path
|
paths[name] = path
|
||||||
}
|
}
|
||||||
m.Paths = paths
|
m.Paths = paths
|
||||||
|
|||||||
Reference in New Issue
Block a user