From: Michael Olbrich Date: Wed, 23 Jan 2013 13:12:16 +0000 (+0100) Subject: service: make sure the watchdog timer is not restarted while stopping X-Git-Tag: v198~420 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=90527fbb2c48ffda5c6d8f232f8993a90b2632a4 service: make sure the watchdog timer is not restarted while stopping A watchdog notification may be handled after the watchdog timer was stopped while stopping the service. As a result the timer is restarted and the service may be restarted as well. The watchdog timestamp is initially set during startup in service_enter_start_post() and cleared when the timer is stopped. Therefore it can be used as an indication if the timer should be reset. --- diff --git a/src/core/service.c b/src/core/service.c index 593946e51..baddc5ade 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3400,7 +3400,8 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { if (strv_find(tags, "WATCHDOG=1")) { log_debug_unit(u->id, "%s: got WATCHDOG=1", u->id); - service_reset_watchdog(s); + if (dual_timestamp_is_set(&s->watchdog_timestamp)) + service_reset_watchdog(s); } /* Notify clients about changed status or main pid */