diff options
author | Alexander V Vershilov <qnikst@gentoo.org> | 2013-06-30 16:32:30 +0400 |
---|---|---|
committer | Alexander V Vershilov <qnikst@gentoo.org> | 2013-07-01 09:18:02 +0400 |
commit | 992807de55bd9b0e8cbb569a86bb84b75fe9482e (patch) | |
tree | 58e1bee24897b291c53d6da57597652b3023af5c | |
parent | ccb8c5835c2c59d8f85aec531da8a75f004b030b (diff) |
Put a service on into a top hierarchy of each cgroup
This change will fix unwanted cgroup inheriting from user cgroups,
and fixes issues with systemd cgroup tracking by logind.
However this fix can lead to incorrect work for some user cgroup
controllers - so more advanced solution, that coveres such cases
will be created later.
Thanks to Fabio Erculiani (lxnay) for testing and general idea.
-rw-r--r-- | sh/rc-cgroup.sh.in | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in index d96aa164..21f5f50d 100644 --- a/sh/rc-cgroup.sh.in +++ b/sh/rc-cgroup.sh.in @@ -72,6 +72,14 @@ cgroup_set_values() cgroup_set_limits() { + # relocate starting process to the top of the cgroup + # it prevents from unwanted inheriting of the user + # cgroups. But may lead to a problems where that inheriting + # is needed. + for d in /sys/fs/cgroup/* ; do + echo $$ > "${d}"/tasks + done + openrc_cgroup=/sys/fs/cgroup/openrc if [ -d "$openrc_cgroup" ]; then cgroup="$openrc_cgroup/$RC_SVCNAME" |