From 1a44be0f16a7a1de8a176e7c656f8513494e0e64 Mon Sep 17 00:00:00 2001 From: Alexander V Vershilov Date: Sun, 16 Feb 2014 04:27:52 +0400 Subject: [PATCH] cgroups: only run cgroup setup when starting a service Status call should not set limits as it requires root permissions, also this is not safe, as current process may reach limitation. Solution is to set limits and move process to service cgroup only on start. X-GENTOO-BUG: 500364 X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364 --- sh/runscript.sh.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index ceb9ab45..c72a784c 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -215,12 +215,14 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then fi # Apply cgroups settings if defined +if [ "$1" = "start" ] ; then if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then cgroup_add_service /sys/fs/cgroup/openrc cgroup_add_service /sys/fs/cgroup/systemd/system fi [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \ cgroup_set_limits +fi # Load our script sourcex "$RC_SERVICE"