diff --git a/libcontainer/cgroups/utils.go b/libcontainer/cgroups/utils.go index 722a3de0..4f84a28a 100644 --- a/libcontainer/cgroups/utils.go +++ b/libcontainer/cgroups/utils.go @@ -98,12 +98,12 @@ type Mount struct { Subsystems []string } -func (m Mount) GetThisCgroupDir() (string, error) { +func (m Mount) GetThisCgroupDir(cgroups map[string]string) (string, error) { if len(m.Subsystems) == 0 { return "", fmt.Errorf("no subsystem for mount") } - return GetThisCgroupDir(m.Subsystems[0]) + return getControllerPath(m.Subsystems[0], cgroups) } func GetCgroupMounts() ([]Mount, error) { diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go index ecdc7ca6..77593fe3 100644 --- a/libcontainer/rootfs_linux.go +++ b/libcontainer/rootfs_linux.go @@ -253,10 +253,15 @@ func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) { return nil, err } + cgroupPaths, err := cgroups.ParseCgroupFile("/proc/self/cgroup") + if err != nil { + return nil, err + } + var binds []*configs.Mount for _, mm := range mounts { - dir, err := mm.GetThisCgroupDir() + dir, err := mm.GetThisCgroupDir(cgroupPaths) if err != nil { return nil, err }