]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/scope.c
core: clean up inactive/failed {service|scope}'s cgroups when the last process exits
authorAnita Zhang <the.anitazha@gmail.com>
Fri, 23 Oct 2020 05:44:22 +0000 (22:44 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 27 Oct 2020 12:20:40 +0000 (13:20 +0100)
commite08dabfec7304dfa0d59997dc4219ffaf22af717
tree79dd1fbcf993dc8fafea95dce617f6cda174413f
parent397cca2453465d4ad5a51b16ad71acf45a3de352
core: clean up inactive/failed {service|scope}'s cgroups when the last process exits

If processes remain in the unit's cgroup after the final SIGKILL is
sent and the unit has exceeded stop timeout, don't release the unit's
cgroup information. Pid1 will have failed to `rmdir` the cgroup path due
to processes remaining in the cgroup and releasing would leave the cgroup
path on the file system with no tracking for pid1 to clean it up.

Instead, keep the information around until the last process exits and pid1
sends the cgroup empty notification. The service/scope can then prune
the cgroup if the unit is inactive/failed.
src/core/cgroup.c
src/core/cgroup.h
src/core/scope.c
src/core/service.c