[systemd-devel] [PATCH 1/2] service: really stop watchdog timer when stopping

Lennart Poettering lennart at poettering.net
Wed Mar 6 06:28:29 PST 2013


On Wed, 23.01.13 14:12, Michael Olbrich (m.olbrich at pengutronix.de) wrote:

> For services without ExecStop= the state SERVICE_STOP is never entered. as
> a result the watchdog timer is not stopped and the service is restarted (if
> it is configuered to restart).
> Stopping the watchdog timer for SERVICE_STOP_SIGTERM as well fixes this.
> ---
>  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 ee5a1a4..593946e 100644
> --- a/src/core/service.c
> +++ b/src/core/service.c
> @@ -1550,7 +1550,7 @@ static void service_set_state(Service *s, ServiceState state) {
>                  service_connection_unref(s);
>          }
>  
> -        if (state == SERVICE_STOP)
> +        if (state == SERVICE_STOP || state == SERVICE_STOP_SIGTERM)
>                  service_stop_watchdog(s);
>  
>          /* For the inactive states unit_notify() will trim the cgroup,


Hmm, shouldn't we invert the check for robustness reasons, and basically
just list the states where it should *not* be stopped? THat sounds much
nicer to me, especially if we might add additional states to the state
machine later on.

Could you cook up a patch?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list