[systemd-devel] Should automount units for network filesystems be Before=local-fs.target?

Lennart Poettering lennart at poettering.net
Sat Apr 29 11:26:33 UTC 2017


On Thu, 27.04.17 15:53, Michael Chapman (mike at very.puzzling.org) wrote:

> Hello all,
> 
> At present, when systemd-fstab-generator creates an automount unit for an
> fstab entry, it applies the dependencies that would have been put into the
> mount unit into the automount unit instead.
> 
> For a local filesystem, this automount unit would be Before=local-fs.target.
> For a network filesystem, it gets Before=remote-fs.target. If the mount is
> not noauto, it also gets a corresponding WantedBy= or RequiredBy=
> dependency.
> 
> Would it make more sense for the automount unit to be ordered before (and,
> if not noauto, be pulled in by) local-fs.target, even for network
> filesystems?

We can't really do that in the generic case, sorry. The distinction
between local-fs.target and remote-fs.target mostly exists because the
latter may rely on network management services which aren't available
in early boot. Spefically, NetworkManager traditionally runs during
late boot, not during early boot. Now, if we'd permit that an autofs
mount is already established in early boot but can only be fulfilled
in late boot, then we'd open the doors to a variety of deadlocks
triggered by early-boot services accessing these mounts at a point in
time where the backing mounts cannot be established yet.

You can do what you want locally though if you are reasonably sure
that such a deadlock cannot be triggered (for example, because you
know that your networking management solution already runs in early
boot). One way to do this is by adding
"x-systemd.before=local-fs.target" as mount option to the relevant
mounts in fstab. (note though that x-systemd.before= is a relatively
recent addition to systemd though)

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list