core/mount: add dependencies to dynamically mounted mounts too

Add unit dependencies for dynamic (i. e. not from fstab) mounts. With that,
mount units properly bind to their underlying device, and thus get
automatically stopped/unmounted when the underlying device goes away.

This cleans up stale mounts from unplugged devices.

Thanks to Lennart Poettering for pointing out the fix!
This commit is contained in:
Martin Pitt 2015-01-28 13:53:25 +01:00 committed by Lennart Poettering
parent 3315f08517
commit 06e9788888

View file

@ -300,7 +300,7 @@ static int mount_add_device_links(Mount *m) {
assert(m);
p = get_mount_parameters_fragment(m);
p = get_mount_parameters(m);
if (!p)
return 0;