cgroup_namespaces.7: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-06-10 12:04:48 +02:00
parent c919e22f82
commit 146842f921
1 changed files with 8 additions and 8 deletions

View File

@ -102,11 +102,11 @@ Next, we use
.BR unshare (1)
to create a process running a new shell in new cgroup and mount namespaces:
.PP
.EX
.in +4n
.EX
# \fBPS1="sh2# " unshare \-Cm bash\fP
.in
.EE
.in
.PP
From the new shell started by
.BR unshare (1),
@ -118,16 +118,16 @@ a process that is in the initial cgroup namespace
with PID 1), and the process in the sibling cgroup
.RI ( sub2 ):
.PP
.EX
.in +4n
.EX
sh2# \fBcat /proc/self/cgroup | grep freezer\fP
7:freezer:/
sh2# \fBcat /proc/1/cgroup | grep freezer\fP
7:freezer:/..
sh2# \fBcat /proc/20124/cgroup | grep freezer\fP
7:freezer:/../sub2
.in
.EE
.in
.PP
From the output of the first command,
we see that the freezer cgroup membership of the new shell
@ -147,12 +147,12 @@ However, when we look in
.IR /proc/self/mountinfo
we see the following anomaly:
.PP
.EX
.in +4n
.EX
sh2# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 /.. /sys/fs/cgroup/freezer ...
.in
.EE
.in
.PP
The fourth field of this line
.RI ( /.. )
@ -169,16 +169,16 @@ To fix this problem, we must remount the freezer cgroup filesystem
from the new shell (i.e., perform the mount from a process that is in the
new cgroup namespace), after which we see the expected results:
.PP
.EX
.in +4n
.EX
sh2# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events
# to other namespaces
sh2# \fBumount /sys/fs/cgroup/freezer\fP
sh2# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP
sh2# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ...
.in
.EE
.in
.\"
.SH CONFORMING TO
Namespaces are a Linux-specific feature.