[systemd-devel] Requires and After

Jonathon Kowalski bl0pbl33p at gmail.com
Wed Jan 2 21:21:15 UTC 2019


On Wed, Jan 2, 2018, Zbigniew Jędrzejewski-Szmek wrote:
>The short answer is that Requires without After is mostly meaningless,
>because it's impossible for systemd to actually implement the check,
>so effectively Requires downgrades to Wants

It doesn't downgrade to Wants=, because if the dependent job fails
before the dependee completes, it will have its job cancelled with a
JOB_DEPENDENCY job result, however the transaction remains unaffected
in case of Wants=.

> Two considerations though:
> - For Wants=, it is OK to not have an ordering dependency.
>
>   So if we made Requires= imply After=, there'd be an inconsistency
>   between Requires= and Wants=.
>
> - When .requires/ is used (and .wants/ too), an After= dependency is
>   added automatically.
>
> I think we could consider making Requires= imply After=, with the
> necessary notices in NEWS, if somebody looks through units (e.g. all
> the ones packaged in Fedora), to verify that this is unlikely to break
> existing units. Elsewhere in the thread, somebody mentioned openstack,
> so that'd be first thing to check.

This is very ugly, is why I don't like this. Now, we'll have to tell
people to add After= when they use Wants= in services (in cases where
they need it), and only for that. At this point many are accustomed to
the practice of declaring ordering relationships. Now, Wants= has
different implicit ordering when configured through the filesystem
rather than the unit (and no, while the primary use case was for
targets for which it makes sense, breaking those use cases which
expected .wants links to produce no ordering effect is undesirable,
for other units).
Also, if people *are* going to do that (not that I agree), then adding
it to BindsTo= makes sense too.


More information about the systemd-devel mailing list