[systemd-devel] mount units and symlinks

Colin Walters walters at verbum.org
Mon Jun 30 12:23:17 PDT 2014


Hi, we were trying to update systemd to git master in gnome-continuous,
and hit an issue with mount points that are symlinks.

It's pretty easy to reproduce:

mkdir /mnt/a
ln -s a /mnt/b
cat > /etc/systemd/system/mnt-b.mount << EOF
[Mount]
What=tmpfs
Where=/mnt/b
Type=tmpfs
Options=mode=1777,strictatime
EOF
systemctl daemon-reload
systemctl start mnt-b.mount

# Notice that we can see this mount via *both* units:
systemctl status mnt-a.mount
systemctl status mnt-b.mount

# Now let's do an unrelated mount:

mkdir /mnt/unrelated
mount --bind /mnt/unrelated /mnt/unrelated

systemctl status mnt-a.mount
systemctl status mnt-b.mount
# Notice mnt-b died

This happens because on any mountpoint change, we mark all mounts as
dead, and only reload the ones we see.  But the kernel resolved the b ->
a symlink at mount time, so it doesn't exist from the kernel's
perspective.

In gnome-continuous this breaks the /tmp -> /sysroot/tmp link; which I
could work around in a different way perhaps, but it would be nice if
systemd had better semantics for mount points that are symlinks.

What would the right thing here be?  Should e.g. systemd follow the
links and create two units from mount points that contain symlinks,
explicitly having the source reflect destination?




More information about the systemd-devel mailing list