summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Koegel <eric.koegel@gmail.com>2016-04-10 19:36:25 +0300
committerEric Koegel <eric.koegel@gmail.com>2016-04-10 19:36:25 +0300
commit162c0480fe9d2de4471a0e074d2224abaed61e3b (patch)
tree23c96995070aaf610042409c63bd2e04cd20f03b /src
parent664d2fdbd966764836b1f4da2dbc5750c7f01f0f (diff)
downloadConsoleKit2-162c0480fe9d2de4471a0e074d2224abaed61e3b.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/ck-process-group.c16
1 files changed, 14 insertions, 2 deletions
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;