]> git.proxmox.com Git - mirror_lxc.git/commit - src/tests/cgpath.c
cgroups: rework to handle nested containers with multiple and partial mounts
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 10 Aug 2013 04:47:37 +0000 (23:47 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 14 Aug 2013 15:51:01 +0000 (10:51 -0500)
commitb98f7d6ed1b89b6452af4a2b5e27d445e4b3a138
tree79239701c1c5bac31514f271cc90410e64750340
parent070a4b8e68a6bf9a96c24ded47974388c83f1d57
cgroups: rework to handle nested containers with multiple and partial mounts

Currently, if you create a container and use the mountcgruop hook,
you get the /lxc/c1/c1.real cgroup mounted to /.  If you then try
to start containers inside that container, lxc can get confused.
This patch addresses that, by accepting that the cgroup as found
in /proc/self/cgroup can be partially hidden by bind mounts.

In this patch:

Add optional 'lxc.cgroup.use' to /etc/lxc/lxc.conf to specify which
mounted cgroup filesystems lxc should use.  So far only the cgroup
creation respects this.

Keep separate cgroup information for each cgroup mountpoint.  So if
the caller is in devices cgroup /a but cpuset cgroup /b that should
now be ok.

Change how we decide whether to ignore failure to set devices cgroup
settings.  Actually look to see if our current cgroup already has the
settings.  If not, add them.

Finally, the real reason for this patch: in a nested container,
/proc/self/cgroup says nothing about where under /sys/fs/cgroup you
might find yourself.  Handle this by searching for our pid in tasks
files, and keep that info in the cgroup handler.

Also remove all strdupa from cgroup.c (not android-friendly).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
12 files changed:
src/lxc/cgroup.c
src/lxc/cgroup.h
src/lxc/commands.c
src/lxc/commands.h
src/lxc/conf.c
src/lxc/conf.h
src/lxc/freezer.c
src/lxc/lxc.h
src/lxc/lxcutmp.c
src/lxc/start.c
src/lxc/start.h
src/tests/cgpath.c