Commit 036d0949 authored by Michael Biebl's avatar Michael Biebl

Use the right timeout for stop processes we fork

This ensures that services are properly killed after a given timeout.

Closes: #813702
parent 5a66460e
systemd (215-17+deb8u5) UNRELEASED; urgency=medium
* Use the right timeout for stop processes we fork. This ensures that
services are properly killed after a given timeout. (Closes: #813702)
-- Michael Biebl <biebl@debian.org> Fri, 01 Jul 2016 17:35:05 +0200
systemd (215-17+deb8u4) stable; urgency=medium
[ Martin Pitt ]
......
......@@ -158,6 +158,7 @@ delta-Fix-broken-separator-support.patch
sd-dhcp-client-make-request-broadcasts-configurable.patch
make-sure-all-swap-units-are-ordered-before-the-swap-targ.patch
nspawn-fix-network-interface.patch
service-use-the-right-timeout-for-stop-processes-we-fork.patch
## Debian specific patches:
Add-back-support-for-Debian-specific-config-files.patch
......
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 21 Aug 2014 18:01:22 +0200
Subject: service: use the right timeout for stop processes we fork
(cherry-picked from commit 21b2ce39d4038cd6176394836fdcfb7fba63f424)
---
src/core/service.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 73a0e84..e60757b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -875,7 +875,7 @@ fail:
static int service_spawn(
Service *s,
ExecCommand *c,
- bool timeout,
+ usec_t timeout,
bool pass_fds,
bool apply_permissions,
bool apply_chroot,
@@ -920,8 +920,8 @@ static int service_spawn(
}
}
- if (timeout && s->timeout_start_usec > 0) {
- r = service_arm_timer(s, s->timeout_start_usec);
+ if (timeout > 0) {
+ r = service_arm_timer(s, timeout);
if (r < 0)
goto fail;
} else
@@ -1123,7 +1123,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
r = service_spawn(s,
s->control_command,
- true,
+ s->timeout_stop_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1214,7 +1214,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
r = service_spawn(s,
s->control_command,
- true,
+ s->timeout_stop_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1269,7 +1269,7 @@ static void service_enter_start_post(Service *s) {
r = service_spawn(s,
s->control_command,
- true,
+ s->timeout_start_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1334,8 +1334,7 @@ static void service_enter_start(Service *s) {
r = service_spawn(s,
c,
- s->type == SERVICE_FORKING || s->type == SERVICE_DBUS ||
- s->type == SERVICE_NOTIFY || s->type == SERVICE_ONESHOT,
+ IN_SET(s->type, SERVICE_FORKING, SERVICE_DBUS, SERVICE_NOTIFY, SERVICE_ONESHOT) ? s->timeout_start_usec : 0,
true,
true,
true,
@@ -1402,7 +1401,7 @@ static void service_enter_start_pre(Service *s) {
r = service_spawn(s,
s->control_command,
- true,
+ s->timeout_start_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1476,7 +1475,7 @@ static void service_enter_reload(Service *s) {
r = service_spawn(s,
s->control_command,
- true,
+ s->timeout_start_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1515,7 +1514,7 @@ static void service_run_next_control(Service *s) {
r = service_spawn(s,
s->control_command,
- true,
+ IN_SET(s->state, SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD) ? s->timeout_start_usec : s->timeout_stop_usec,
false,
!s->permissions_start_only,
!s->root_directory_start_only,
@@ -1561,7 +1560,7 @@ static void service_run_next_main(Service *s) {
r = service_spawn(s,
s->main_command,
- true,
+ s->timeout_start_usec,
true,
true,
true,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment