From 79aafbd122eba37df6512f2071cd2c3cf59d46ee Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 2 Oct 2017 14:40:15 +0100 Subject: [PATCH 1/2] core: distinguish "Killing"/"Terminating"/"Stopping" for mount unit timeout Update the timeout warnings for remount and unmount. For consistency with mount, for accuracy, and for consistency with their equivalents in service.c. --- src/core/mount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index 9fde132faa..9b582072c6 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -1363,7 +1363,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user break; case MOUNT_REMOUNTING: - log_unit_warning(UNIT(m), "Remounting timed out. Killing remount process."); + log_unit_warning(UNIT(m), "Remounting timed out. Terminating remount process."); mount_set_reload_result(m, MOUNT_FAILURE_TIMEOUT); mount_enter_signal(m, MOUNT_REMOUNTING_SIGTERM, MOUNT_SUCCESS); break; @@ -1388,7 +1388,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user break; case MOUNT_UNMOUNTING: - log_unit_warning(UNIT(m), "Unmounting timed out. Stopping."); + log_unit_warning(UNIT(m), "Unmounting timed out. Terminating."); mount_enter_signal(m, MOUNT_UNMOUNTING_SIGTERM, MOUNT_FAILURE_TIMEOUT); break; From 4cd9fa8176aa8e291cc5f169fd26752850b124dd Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 14 Aug 2017 11:15:38 +0100 Subject: [PATCH 2/2] core: failure to spawn ExecStartPost should not run ExecStop Failure to spawn ExecStartPost was being handled differently to e.g. EXIT_FAILURE returned by ExecStartPost. It looks like this was an oversight. Fix to match documented behaviour. `man systemd.service`: > Note that if any of the commands specified in ExecStartPre=, ExecStart=, > or ExecStartPost= fail (and are not prefixed with "-", see above) or time > out before the service is fully up, execution continues with commands > specified in ExecStopPost=, the commands in ExecStop= are skipped. --- src/core/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/service.c b/src/core/service.c index 915943aff3..78f315ad18 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2087,7 +2087,7 @@ static void service_run_next_control(Service *s) { fail: log_unit_warning_errno(UNIT(s), r, "Failed to run next control task: %m"); - if (IN_SET(s->state, SERVICE_START_PRE, SERVICE_STOP)) + if (IN_SET(s->state, SERVICE_START_PRE, SERVICE_START_POST, SERVICE_STOP)) service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES); else if (s->state == SERVICE_STOP_POST) service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);