[systemd-devel] Dependency loop due to network filesystem and quotacheck; suboptimal loop resolution.

Lennart Poettering lennart at poettering.net
Thu Mar 17 14:33:21 PDT 2011


On Thu, 17.03.11 21:35, Andrey Borzenkov (arvidjaar at gmail.com) wrote:

> On Thu, Mar 17, 2011 at 4:43 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > Anywaym uf you rework this patch to check for the usrquota/grpquota
> > options I'd merge it promptly (or you can even merge it yourself, if
> > Tollef grants you git access by then ;-)). Even better would be if you
> > add a WANTS dep too, so that we can remove the service from being pulled
> > in by default sysinit.target.
> 
> Like attached patch?

Almost:

> +
> +                if (!p ||
> +                    (!mount_test_option(p->options, "_netdev") &&
> +                    !(p->fstype && fstype_is_network(p->fstype)) &&
> +                    (mount_test_option(p->options, "usrquota") || mount_test_option(p->options, "grpquota"))))
> +                        if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
> +                            (r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0 ||
> +                            (r = unit_add_dependency_by_name(UNIT(m), UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
> +                            (r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
> +                                return r;

Please use unit_add_two_dependencies_by_name() instead here. That allows
you to create the BEFORE and WANTS dep in one step.

(Oh, and you are creating before quotaon.service twice, you want to
replace one UNIT_BEFORE by UNIT_WANTS).

But otherwise looks good. Please fix and then apply.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list