fstab-generator: Chase symlinks where possible (#6293)
authorColin Walters <walters@verbum.org>
Tue, 11 Jul 2017 16:48:57 +0000 (12:48 -0400)
committerLennart Poettering <lennart@poettering.net>
Tue, 11 Jul 2017 16:48:57 +0000 (18:48 +0200)
commit634735b56b82bdde3c67193ba7b470bab80fdcbd
tree557e01b8d5e2ced28a9ff8df13f02e13a482661b
parentcd2d4c7f689cc02b5a592e9212b30e46c516b676
fstab-generator: Chase symlinks where possible (#6293)

This has a long history; see see 5261ba901845c084de5a8fd06500ed09bfb0bd80
which originally introduced the behavior.  Unfortunately that commit
doesn't include any rationale, but IIRC the basic issue is that
systemd wants to model the real mount state as units, and symlinks
make canonicalization much more difficult.

At the same time, on a RHEL6 system (upstart), one can make e.g. `/home` a
symlink, and things work as well as they always did; but one doesn't have
access to the sophistication of mount units (dependencies, introspection, etc.)
Supporting symlinks here will hence make it easier for people to do upgrades to
RHEL7 and beyond.

The `/home` as symlink case also appears prominently for OSTree; see
https://ostree.readthedocs.io/en/latest/manual/adapting-existing/

Further work has landed in the nspawn case for this; see e.g.
d944dc9553009822deaddec76814f5642a6a8176

A basic limitation with doing this in the fstab generator (and that I hit while
doing some testing) is that we obviously can't chase symlinks into mounts,
since the generator runs early before mounts. Or at least - doing so would
require multiple passes over the fstab data (as well as looking at existing
mount units), and potentially doing multi-phase generation. I'm not sure it's
worth doing that without a real world use case. For now, this will fix at least
the OSTree + `/home` <https://bugzilla.redhat.com/show_bug.cgi?id=1382873> case
mentioned above, and in general anyone who for whatever reason has symlinks in
their `/etc/fstab`.
man/systemd-fstab-generator.xml
man/systemd.mount.xml
src/fstab-generator/fstab-generator.c