[systemd-commits] 2 commits - src/core

Lennart Poettering lennart at kemper.freedesktop.org
Wed Jan 29 08:46:54 PST 2014


 src/core/mount.c   |    8 +++++++-
 src/core/scope.c   |    4 +++-
 src/core/service.c |   10 +++++++---
 src/core/socket.c  |    6 +++++-
 src/core/swap.c    |    6 +++++-
 src/core/unit.c    |    7 ++-----
 6 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit 6294b8a92db8579210d4fc9ce74097a15005b3e6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 29 14:59:45 2014 +0100

    core: use a bit more PID_FMT

diff --git a/src/core/unit.c b/src/core/unit.c
index 0ad679b..6427f91 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2938,8 +2938,7 @@ int unit_kill_context(
                         _cleanup_free_ char *comm = NULL;
                         get_process_comm(main_pid, &comm);
 
-                        log_warning_unit(u->id, "Failed to kill main process %li (%s): %s",
-                                         (long) main_pid, strna(comm), strerror(-r));
+                        log_warning_unit(u->id, "Failed to kill main process " PID_FMT " (%s): %s", main_pid, strna(comm), strerror(-r));
                 } else {
                         wait_for_exit = !main_pid_alien;
 
@@ -2955,9 +2954,7 @@ int unit_kill_context(
                         _cleanup_free_ char *comm = NULL;
                         get_process_comm(control_pid, &comm);
 
-                        log_warning_unit(u->id,
-                                         "Failed to kill control process %li (%s): %s",
-                                         (long) control_pid, strna(comm), strerror(-r));
+                        log_warning_unit(u->id, "Failed to kill control process " PID_FMT " (%s): %s", control_pid, strna(comm), strerror(-r));
                 } else {
                         wait_for_exit = true;
 

commit ac84d1fb5a7293df4f75544eedf148ba0bb4ec21
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 29 14:58:04 2014 +0100

    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.

diff --git a/src/core/mount.c b/src/core/mount.c
index 90da883..45c0040 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 87983f6..5beb4f8 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 1ec2e51..0542eae 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 7eac0eb..5f16493 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 26141e6..d53cabe 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;



More information about the systemd-commits mailing list