chiark / gitweb /
cgroup: mention signal name when killing cgroups
[elogind.git] / cgroup.c
index 4ceaf382771a803e0a692c26f8d791bfb28ca3d0..410eaf7e80da44a7c243b7ca6511a2b5e348a8f4 100644 (file)
--- a/cgroup.c
+++ b/cgroup.c
@@ -183,7 +183,7 @@ int cgroup_bonding_kill(CGroupBonding *b, int sig) {
         if (!(s = set_new(trivial_hash_func, trivial_compare_func)))
                 return -ENOMEM;
 
-        log_debug("Killing processes from process group %s:%s", b->controller, b->path);
+        log_debug("Killing processes from process group %s:%s with %s", b->controller, b->path, strsignal(sig));
 
         do {
                 void *iterator;
@@ -478,7 +478,7 @@ int manager_setup_cgroup(Manager *m) {
         return r;
 }
 
-int manager_shutdown_cgroup(Manager *m) {
+int manager_shutdown_cgroup(Manager *m, bool delete) {
         struct cgroup *cg;
         int r;
 
@@ -495,11 +495,10 @@ int manager_shutdown_cgroup(Manager *m) {
                 goto finish;
         }
 
-        if ((r = cgroup_delete_cgroup_ext(cg, CGFLAG_DELETE_IGNORE_MIGRATION|CGFLAG_DELETE_RECURSIVE)) != 0) {
-                log_error("Failed to delete cgroup hierarchy group: %s", cgroup_strerror(r));
-                r = translate_error(r, errno);
-                goto finish;
-        }
+        /* Often enough we won't be able to delete the cgroup we
+         * ourselves are in, hence ignore all errors here */
+        if (delete)
+                cgroup_delete_cgroup_ext(cg, CGFLAG_DELETE_IGNORE_MIGRATION|CGFLAG_DELETE_RECURSIVE);
         r = 0;
 
 finish: