[systemd-devel] [PATCH] core: get rid the start job when transitioning to deactivating

Lennart Poettering lennart at poettering.net
Thu Jul 18 11:02:33 PDT 2013


On Thu, 18.07.13 17:04, Michal Sekletar (msekleta at redhat.com) wrote:

> When dependency unit is configured with StopWhenUnneeded=yes and
> activation of main unit fails, e.g.  start timeout occurs, then
> dependencies are never stopped. This happens because start job for
> the main unit is still around.
> ---
>  src/core/unit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/core/unit.c b/src/core/unit.c
> index 0e9329f..d5c89a4 100644
> --- a/src/core/unit.c
> +++ b/src/core/unit.c
> @@ -1461,7 +1461,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
>                          else if (u->job->state == JOB_RUNNING && ns != UNIT_ACTIVATING) {
>                                  unexpected = true;
>  
> -                                if (UNIT_IS_INACTIVE_OR_FAILED(ns))
> +                                if (UNIT_IS_INACTIVE_OR_FAILED(ns) || UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
>                                          job_finish_and_invalidate(u->job, ns == UNIT_FAILED ? JOB_FAILED : JOB_DONE, true);
>                          }
>  

Hmm, so UNIT_IS_INACTIVE_OR_DEACTIVATING() actually tests for a superset
of UNIT_IS_INACTIVE_OR_FAILED(), so oring them is unnecessary.

I am not entirely grokking the patch though. So far the idea was that if
a unit is being deactviated while a start job is queued that we then
simply wait until the deactivation is complete and then execute the
start job. This would break with your patch though...

Hmm, can you eleraborate on the actual problem you are trying to solve=
I don't get it so far ;-)

Thanks,

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list