aboutsummaryrefslogtreecommitdiffstats
path: root/etc/systemd
diff options
context:
space:
mode:
authorPavel Zakharov <[email protected]>2019-07-17 18:33:05 -0400
committerBrian Behlendorf <[email protected]>2019-07-17 15:33:05 -0700
commit26b60474691ad4bdb91f61b667819e22aabc202f (patch)
tree268a5e17012042c2b7d444b212c2293997ffaced /etc/systemd
parentd64dd3b62a5411e628ce59b11fe50ba848d12ffc (diff)
New service that waits on zvol links to be created
The zfs-volume-wait.service scans existing zvols and waits for their links under /dev to be created. Any service that depends on zvol links to be there should add a dependency on zfs-volumes.target. By default, this target is not enabled. Reviewed-by: Fabian Grünbichler <[email protected]> Reviewed-by: Antonio Russo <[email protected]> Reviewed-by: Richard Laager <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: John Gallagher <[email protected]> Reviewed-by: George Wilson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Pavel Zakharov <[email protected]> Closes #8975
Diffstat (limited to 'etc/systemd')
-rw-r--r--etc/systemd/system/50-zfs.preset.in1
-rw-r--r--etc/systemd/system/Makefile.am4
-rw-r--r--etc/systemd/system/zfs-volume-wait.service.in13
-rw-r--r--etc/systemd/system/zfs-volumes.target.in7
4 files changed, 25 insertions, 0 deletions
diff --git a/etc/systemd/system/50-zfs.preset.in b/etc/systemd/system/50-zfs.preset.in
index 884a69b5b..e4056a92c 100644
--- a/etc/systemd/system/50-zfs.preset.in
+++ b/etc/systemd/system/50-zfs.preset.in
@@ -5,4 +5,5 @@ enable zfs-import.target
enable zfs-mount.service
enable zfs-share.service
enable zfs-zed.service
+enable zfs-volume-wait.service
enable zfs.target
diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
index 1586209ca..9249f15eb 100644
--- a/etc/systemd/system/Makefile.am
+++ b/etc/systemd/system/Makefile.am
@@ -7,7 +7,9 @@ systemdunit_DATA = \
zfs-import-scan.service \
zfs-mount.service \
zfs-share.service \
+ zfs-volume-wait.service \
zfs-import.target \
+ zfs-volumes.target \
zfs.target
EXTRA_DIST = \
@@ -17,6 +19,8 @@ EXTRA_DIST = \
$(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-volume-wait.service.in \
+ $(top_srcdir)/etc/systemd/system/zfs-volumes.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-volume-wait.service.in b/etc/systemd/system/zfs-volume-wait.service.in
new file mode 100644
index 000000000..75bd9fcdd
--- /dev/null
+++ b/etc/systemd/system/zfs-volume-wait.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Wait for ZFS Volume (zvol) links in /dev
+DefaultDependencies=no
+After=systemd-udev-settle.service
+After=zfs-import.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@bindir@/zvol_wait
+
+[Install]
+WantedBy=zfs-volumes.target
diff --git a/etc/systemd/system/zfs-volumes.target.in b/etc/systemd/system/zfs-volumes.target.in
new file mode 100644
index 000000000..5cb9a10f4
--- /dev/null
+++ b/etc/systemd/system/zfs-volumes.target.in
@@ -0,0 +1,7 @@
+[Unit]
+Description=ZFS volumes are ready
+After=zfs-volume-wait.service
+Requires=zfs-volume-wait.service
+
+[Install]
+WantedBy=zfs.target