From 162c0480fe9d2de4471a0e074d2224abaed61e3b Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sun, 10 Apr 2016 19:36:25 +0300 Subject: Attempt to use 'cpuaccount' if 'all' cgroup fails on pid move For whatever reason, sometimes moving the pid into all the cgroups with cgmanager fails, but we only require cpuaccount for our internal use so try that as a fallback. --- src/ck-process-group.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ck-process-group.c b/src/ck-process-group.c index 4b4e9be..5a09869 100644 --- a/src/ck-process-group.c +++ b/src/ck-process-group.c @@ -260,7 +260,19 @@ ck_process_group_create (CkProcessGroup *pgroup, * cgmanager. */ throw_nih_warning (_("Failed to move the session leader process to cgroup, the error was: %s")); - return FALSE; + + /* We failed to move the process into all the cgroups, but + * we really only require the cpuacct for our internal use. + * So try that as a fallback now. + */ + ret = cgmanager_move_pid_abs_sync (NULL, priv->cgmanager_proxy, "cpuacct", ssid, process); + if (ret != 0) { + /* TRANSLATORS: Please ensure you keep the %s in the + * string somewhere. It's the detailed error message from + * cgmanager. + */ + throw_nih_warning (_("Failed to move the session leader process to 'cpuacct' cgroup, the error was: %s")); + } } ret = cgmanager_remove_on_empty_sync (NULL, priv->cgmanager_proxy, "all", ssid); @@ -270,7 +282,7 @@ ck_process_group_create (CkProcessGroup *pgroup, * cgmanager. */ throw_nih_warning (_("Failed to let cgmanager know that it can remove the cgroup when it's empty, the error was: %s")); - return FALSE; + /* this is not an issue if it fails */ } return TRUE; -- cgit v1.2.3