aboutsummaryrefslogtreecommitdiffstats
path: root/etc/systemd
diff options
context:
space:
mode:
authorAntonio Russo <[email protected]>2017-10-30 16:18:26 -0400
committerBrian Behlendorf <[email protected]>2017-10-30 13:18:26 -0700
commit5c2552c56456191e8038efe25ed66270c3f1501a (patch)
tree468d9ad783dc26c92967c4418aa1ba328eb2fe00 /etc/systemd
parentca85d690974c4c1e12f1bd5eadfa47806ba01f89 (diff)
systemd zfs-import.target and documentation
zfs-import-{cache,scan}.service must complete before any mounting of filesystems can occur. To simplify this dependency, create a target that is reached After (in the systemd sense) the pool is imported. Additionally, recommend that legacy zfs mounts use the option x-systemd.requires=zfs-import.target to codify this requirement. Reviewed-by: Fabian Grünbichler <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #6764
Diffstat (limited to 'etc/systemd')
-rw-r--r--etc/systemd/system/Makefile.am2
-rw-r--r--etc/systemd/system/zfs-import-cache.service.in4
-rw-r--r--etc/systemd/system/zfs-import-scan.service.in4
-rw-r--r--etc/systemd/system/zfs-import.target.in6
-rw-r--r--etc/systemd/system/zfs-mount.service.in3
5 files changed, 13 insertions, 6 deletions
diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
index b097497e0..1586209ca 100644
--- a/etc/systemd/system/Makefile.am
+++ b/etc/systemd/system/Makefile.am
@@ -7,6 +7,7 @@ systemdunit_DATA = \
zfs-import-scan.service \
zfs-mount.service \
zfs-share.service \
+ zfs-import.target \
zfs.target
EXTRA_DIST = \
@@ -15,6 +16,7 @@ EXTRA_DIST = \
$(top_srcdir)/etc/systemd/system/zfs-import-scan.service.in \
$(top_srcdir)/etc/systemd/system/zfs-mount.service.in \
$(top_srcdir)/etc/systemd/system/zfs-share.service.in \
+ $(top_srcdir)/etc/systemd/system/zfs-import.target.in \
$(top_srcdir)/etc/systemd/system/zfs.target.in \
$(top_srcdir)/etc/systemd/system/50-zfs.preset.in
diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in
index 6170676d9..1c207f742 100644
--- a/etc/systemd/system/zfs-import-cache.service.in
+++ b/etc/systemd/system/zfs-import-cache.service.in
@@ -7,6 +7,7 @@ After=systemd-udev-settle.service
After=cryptsetup.target
After=systemd-remount-fs.service
Before=dracut-mount.service
+Before=zfs-import.target
ConditionPathExists=@sysconfdir@/zfs/zpool.cache
[Service]
@@ -16,5 +17,4 @@ ExecStartPre=/sbin/modprobe zfs
ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN
[Install]
-WantedBy=zfs-mount.service
-WantedBy=zfs.target
+WantedBy=zfs-import.target
diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
index 9254fd3da..d73b2b9dc 100644
--- a/etc/systemd/system/zfs-import-scan.service.in
+++ b/etc/systemd/system/zfs-import-scan.service.in
@@ -6,6 +6,7 @@ Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
After=cryptsetup.target
Before=dracut-mount.service
+Before=zfs-import.target
ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
[Service]
@@ -15,5 +16,4 @@ ExecStartPre=/sbin/modprobe zfs
ExecStart=@sbindir@/zpool import -aN -o cachefile=none
[Install]
-WantedBy=zfs-mount.service
-WantedBy=zfs.target
+WantedBy=zfs-import.target
diff --git a/etc/systemd/system/zfs-import.target.in b/etc/systemd/system/zfs-import.target.in
new file mode 100644
index 000000000..ef25679ab
--- /dev/null
+++ b/etc/systemd/system/zfs-import.target.in
@@ -0,0 +1,6 @@
+[Unit]
+Description=ZFS pool import target
+
+[Install]
+WantedBy=zfs-mount.service
+WantedBy=zfs.target
diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in
index 3da7158cb..8a73716f5 100644
--- a/etc/systemd/system/zfs-mount.service.in
+++ b/etc/systemd/system/zfs-mount.service.in
@@ -3,8 +3,7 @@ Description=Mount ZFS filesystems
Documentation=man:zfs(8)
DefaultDependencies=no
After=systemd-udev-settle.service
-After=zfs-import-cache.service
-After=zfs-import-scan.service
+After=zfs-import.target
After=systemd-remount-fs.service
Before=local-fs.target