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.
This commit is contained in:
Alexander V Vershilov 2013-06-30 16:32:30 +04:00
parent ccb8c5835c
commit 992807de55

View File

@ -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"