[systemd-devel] Restarting service starts stopped dependants

Lennart Poettering lennart at poettering.net
Wed Feb 11 11:35:26 PST 2015


On Mon, 09.02.15 22:46, Andrei Borzenkov (arvidjaar at gmail.com) wrote:

> B is started because C is started so it is not relevant.
> 
> C is started probably due to logic "if A and C are running and you
> restart A you should also restart C". I am not convinced it is the
> right thing to do TBH, but well ...
> 
> Does patch below help?
> 
> diff --git a/src/core/transaction.c b/src/core/transaction.c
> index b0b3d6b..8901119 100644
> --- a/src/core/transaction.c
> +++ b/src/core/transaction.c
> @@ -1027,7 +1027,7 @@ int transaction_add_job_and_dependencies(
>                  if (type == JOB_STOP || type == JOB_RESTART) {
>  
>                          SET_FOREACH(dep, ret->unit->dependencies[UNIT_REQUIRED_BY], i) {
> -                                r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
> +                                r = transaction_add_job_and_dependencies(tr, type == JOB_RESTART ? JOB_TRY_RESTART : type, dep, ret, true, override, false, false, ignore_order, e);
>                                  if (r < 0) {
>                                          if (r != -EBADR)
>                                                  goto fail;

Patch looks like it fixes a real bug. Would be good to get feedback if
this fixes things!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list