Skip to content

Commit 0599ac7

Browse files
committed
Do not create cgroup dir name from combining subsystems
On some systems, when we mount some cgroup subsystems into a same mountpoint, the name sequence of mount options and cgroup directory name can not be the same. For example, the mount option is cpuacct,cpu, but mountpoint name is /sys/fs/cgroup/cpu,cpuacct. In current runc, we set mount destination name from combining subsystems, which comes from mount option from /proc/self/mountinfo, so in my case the name would be /sys/fs/cgroup/cpuacct,cpu, which is differernt from host, and will break some applications. Fix it by using directory name from host mountpoint. Signed-off-by: Qiang Huang <[email protected]>
1 parent eedebb8 commit 0599ac7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcontainer/rootfs_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {
346346
binds = append(binds, &configs.Mount{
347347
Device: "bind",
348348
Source: filepath.Join(mm.Mountpoint, relDir),
349-
Destination: filepath.Join(m.Destination, strings.Join(mm.Subsystems, ",")),
349+
Destination: filepath.Join(m.Destination, filepath.Base(mm.Mountpoint)),
350350
Flags: syscall.MS_BIND | syscall.MS_REC | m.Flags,
351351
PropagationFlags: m.PropagationFlags,
352352
})

0 commit comments

Comments
 (0)