[systemd-devel] [PATCH 2/3] unit: do not care if order isn't right when retroactively starting deps
Lennart Poettering
lennart at poettering.net
Fri Mar 22 19:14:50 PDT 2013
On Wed, 13.03.13 01:44, Michal Schmidt (mschmidt at redhat.com) wrote:
> Attempt to satisfy requirement dependencies retroactively even if
> the unexpectedly activated unit would prefer to be started After them.
>
> This way remote-fs-pre.target can be pulled in by performing a manual
> mount (the mount units have both Wants= and After=
> remote-fs-pre.target).
I am a bit concerned abou this. Wouldn't this also mean that if a mount
for /foobar/waldo suddenly shows up we'd still retroactively mount /foobar too,
if that happens to have a unit file? That sounds wrong, no?
Lennart
> ---
> src/core/unit.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/src/core/unit.c b/src/core/unit.c
> index a6cc3b6..d1f109d 100644
> --- a/src/core/unit.c
> +++ b/src/core/unit.c
> @@ -1226,28 +1226,23 @@ static void retroactively_start_dependencies(Unit *u) {
> assert(UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u)));
>
> SET_FOREACH(other, u->dependencies[UNIT_REQUIRES], i)
> - if (!set_get(u->dependencies[UNIT_AFTER], other) &&
> - !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
>
> SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i)
> - if (!set_get(u->dependencies[UNIT_AFTER], other) &&
> - !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
>
> SET_FOREACH(other, u->dependencies[UNIT_REQUIRES_OVERRIDABLE], i)
> - if (!set_get(u->dependencies[UNIT_AFTER], other) &&
> - !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> manager_add_job(u->manager, JOB_START, other, JOB_FAIL, false, NULL, NULL);
>
> SET_FOREACH(other, u->dependencies[UNIT_REQUISITE], i)
> - if (!set_get(u->dependencies[UNIT_AFTER], other) &&
> - !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
>
> SET_FOREACH(other, u->dependencies[UNIT_WANTS], i)
> - if (!set_get(u->dependencies[UNIT_AFTER], other) &&
> - !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
> manager_add_job(u->manager, JOB_START, other, JOB_FAIL, false, NULL, NULL);
>
> SET_FOREACH(other, u->dependencies[UNIT_CONFLICTS], i)
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list