summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-11 01:51:32 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-11 02:52:34 +0100
commit8f53a7b8ea9ba505f8fefe4df4aaa5a8aab1e2eb (patch)
tree2d28435af78ddd6ef67b00afd2438b54158ecca8 /src/service.c
parentb3fa47e0819b08ea32e69e19e6d88ce2daca069d (diff)
service: brutally slaughter processes that are running in the cgroup when we enter START_PRE and START
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index 0110c9f12f..113be34ad0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2021,6 +2021,11 @@ static void service_enter_start(Service *s) {
else
service_unwatch_main_pid(s);
+ /* We want to ensure that nobody leaks processes from
+ * START_PRE here, so let's go on a killing spree, People
+ * should not spawn long running processes from START_PRE. */
+ cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+
if (s->type == SERVICE_FORKING) {
s->control_command_id = SERVICE_EXEC_START;
c = s->control_command = s->exec_command[SERVICE_EXEC_START];
@@ -2090,6 +2095,11 @@ static void service_enter_start_pre(Service *s) {
service_unwatch_control_pid(s);
if ((s->control_command = s->exec_command[SERVICE_EXEC_START_PRE])) {
+
+ /* Before we start anything, let's clear up what might
+ * be left from previous runs. */
+ cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+
s->control_command_id = SERVICE_EXEC_START_PRE;
if ((r = service_spawn(s,