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

Michael Chapman mike at very.puzzling.org
Thu Apr 27 05:53:51 UTC 2017


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?

In a sense, the automount is a local filesystem, even though the thing 
that will eventually be mounted over the top of it isn't. Furthermore, 
this change would allow services that use automounted network filesystem 
to simply block until the filesystem has been mounted. Currently, for this 
to work correctly during boot, services need to be given explicit 
dependencies (e.g. After=remote-fs.target or RequiresMountsFor=...), since 
otherwise they may get started before the automount unit has started and 
thus be able to "see" the underlying filesystem.

I'm trying to work out what might break with such a change. I suppose it 
is possible somebody has two automounted network filesystems nested within 
one another... the second automount would be dependent upon the first 
being mounted, but that mount won't happen until the network is brought 
up, which is after local-fs.target. This doesn't seem like a particularly 
likely configuration though.

Is there any other reason this change wouldn't work?

-- 
Michael Chapman


More information about the systemd-devel mailing list