From 4195077ab4c823c385cdc3c868a56178f8d93723 Mon Sep 17 00:00:00 2001 From: Michal Koutný Date: Tue, 24 Jan 2017 17:04:32 +0100 Subject: fstab-generator: Apply _netdev option also to device units In case the device field of fstab record is an actual device (not an address) apply same dependencies to the device unit as to the mount unit, i.e. > After=network-online.target network.target > Wants=network-online.targe It makes sense to start the device expecting job only when network is actually ready (consider e.g. iSCSI devices) since it is device's implicit dependency. The eventual implementation should better obtain network flag from udev database and would also take into account device hierarchy (see [1]). This patch approximates that by taking the `_netdev` option as a hint from the user both about the filesystem and underlying device. (For local devices with network filesystems (e.g. ocfs2), this hint leads to unused dependencies.) [1] https://lists.freedesktop.org/archives/systemd-devel/2014-October/024718.html --- src/fstab-generator/fstab-generator.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/fstab-generator') diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 2677a3fb32..43d3308e95 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -399,6 +399,10 @@ static int add_mount( if (r < 0) return r; + r = generator_write_device_deps(dest, what, where, opts); + if (r < 0) + return r; + r = write_mount_timeout(f, where, opts); if (r < 0) return r; -- cgit v1.2.3-54-g00ecf