summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-11-29 15:27:14 +0000
committerLennart Poettering <lennart@poettering.net>2014-12-09 02:28:09 +0100
commitdab5bf859900c0abdbf78c584e4aed42a19768cd (patch)
tree10bea471029d1bef4e21df6d1d61455e23bb14c0 /src/core/cgroup.c
parenteb5800026d5a6754514fb8f8a8561b49974fc879 (diff)
cgroup: Handle error when destroying cgroup
If a cgroup fails to be destroyed (most likely because there are still processes running as part of a service after the main pid exits), don't free and remove the cgroup unit from the manager. This fixes a regression introduced by the cgroup rework in v205 where systemd would forget about processes still running after the unit becomes inactive. (This can happen when the main pid exits and KillMode=process or none).
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 70fc925b4d..af048354e1 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -791,8 +791,10 @@ void unit_destroy_cgroup(Unit *u) {
return;
r = cg_trim_everywhere(u->manager->cgroup_supported, u->cgroup_path, !unit_has_name(u, SPECIAL_ROOT_SLICE));
- if (r < 0)
+ if (r < 0) {
log_debug_errno(r, "Failed to destroy cgroup %s: %m", u->cgroup_path);
+ return;
+ }
hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);