summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-29 14:58:04 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-29 17:46:47 +0100
commitac84d1fb5a7293df4f75544eedf148ba0bb4ec21 (patch)
treeeec35601f6ce583520e3a41076023624ed183160 /src
parentc9cf047362cd8e4530c10bc7c2d6db988452305d (diff)
core: make sure to always go through both SIGTERM and SIGKILL states of units
Given that we now have KillMode=mixed where SIGTERM might kill a smaller set than SIGKILL we need to make sure to always go explicitly throught the SIGKILL state to get the right end result.
Diffstat (limited to 'src')
-rw-r--r--src/core/mount.c8
-rw-r--r--src/core/scope.c4
-rw-r--r--src/core/service.c10
-rw-r--r--src/core/socket.c6
-rw-r--r--src/core/swap.c6
5 files changed, 27 insertions, 7 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 90da88382..45c0040bd 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -854,8 +854,14 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
goto fail;
mount_set_state(m, state);
- } else if (state == MOUNT_REMOUNTING_SIGTERM || state == MOUNT_REMOUNTING_SIGKILL)
+ } else if (state == MOUNT_REMOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_SUCCESS);
+ else if (state == MOUNT_REMOUNTING_SIGKILL)
mount_enter_mounted(m, MOUNT_SUCCESS);
+ else if (state == MOUNT_MOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_MOUNTING_SIGKILL, MOUNT_SUCCESS);
+ else if (state == MOUNT_UNMOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS);
else
mount_enter_dead(m, MOUNT_SUCCESS);
diff --git a/src/core/scope.c b/src/core/scope.c
index 87983f6b1..5beb4f80c 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -238,7 +238,9 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
goto fail;
scope_set_state(s, state);
- } else
+ } else if (state == SCOPE_STOP_SIGTERM)
+ scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_SUCCESS);
+ else
scope_enter_dead(s, SCOPE_SUCCESS);
return;
diff --git a/src/core/service.c b/src/core/service.c
index 1ec2e51fc..0542eae02 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1913,10 +1913,9 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
if (r < 0)
goto fail;
-
service_set_state(s, SERVICE_STOP_POST);
} else
- service_enter_dead(s, SERVICE_SUCCESS, true);
+ service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_SUCCESS);
return;
@@ -1942,6 +1941,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
s->main_pid,
s->control_pid,
s->main_pid_alien);
+
if (r < 0)
goto fail;
@@ -1953,8 +1953,12 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
}
service_set_state(s, state);
- } else if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
+ } else if (state == SERVICE_STOP_SIGTERM)
+ service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_SUCCESS);
+ else if (state == SERVICE_STOP_SIGKILL)
service_enter_stop_post(s, SERVICE_SUCCESS);
+ else if (state == SERVICE_FINAL_SIGTERM)
+ service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_SUCCESS);
else
service_enter_dead(s, SERVICE_SUCCESS, true);
diff --git a/src/core/socket.c b/src/core/socket.c
index 7eac0eb66..5f16493bc 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1344,8 +1344,12 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
goto fail;
socket_set_state(s, state);
- } else if (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_STOP_PRE_SIGKILL)
+ } else if (state == SOCKET_STOP_PRE_SIGTERM)
+ socket_enter_signal(s, SOCKET_STOP_PRE_SIGKILL, SOCKET_SUCCESS);
+ else if (state == SOCKET_STOP_PRE_SIGKILL)
socket_enter_stop_post(s, SOCKET_SUCCESS);
+ else if (state == SOCKET_FINAL_SIGTERM)
+ socket_enter_signal(s, SOCKET_FINAL_SIGKILL, SOCKET_SUCCESS);
else
socket_enter_dead(s, SOCKET_SUCCESS);
diff --git a/src/core/swap.c b/src/core/swap.c
index 26141e6a3..d53cabef2 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -712,7 +712,11 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
goto fail;
swap_set_state(s, state);
- } else
+ } else if (state == SWAP_ACTIVATING_SIGTERM)
+ swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, SWAP_SUCCESS);
+ else if (state == SWAP_DEACTIVATING_SIGTERM)
+ swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, SWAP_SUCCESS);
+ else
swap_enter_dead(s, SWAP_SUCCESS);
return;