diff options
author | Jonathon <[email protected]> | 2020-08-02 00:13:15 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-01 17:13:15 -0700 |
commit | f1de1600d132666d03b3b73a2ab62695a0f60ead (patch) | |
tree | be1259421640afeae96c9539e7bfe3468262e83e /etc/systemd | |
parent | da60484db5960f2b94cf3302dd08fe7fb673eaf3 (diff) |
Verify zfs module loaded before starting services
This is a minor change to the systemd service templates that verifies
the zfs kernel module is loaded by the kernel prior to attempting to
import any zpool.
The services check for the presence of /sys/module/zfs which indicates
the zfs is module is loaded. This uses the systemd built-in check
ConditionPathIsDirectory.
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Thode <[email protected]>
Signed-off-by: Jonathon Fernyhough <[email protected]>
Closes #10663
Diffstat (limited to 'etc/systemd')
-rw-r--r-- | etc/systemd/system/zfs-import-cache.service.in | 2 | ||||
-rw-r--r-- | etc/systemd/system/zfs-import-scan.service.in | 2 | ||||
-rw-r--r-- | etc/systemd/system/zfs-mount.service.in | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index 3697f09c7..47c5b07f8 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -9,11 +9,11 @@ After=multipathd.target After=systemd-remount-fs.service Before=zfs-import.target ConditionPathExists=@sysconfdir@/zfs/zpool.cache +ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes -ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN [Install] diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index 1a352a8ac..6520f3246 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -8,11 +8,11 @@ After=cryptsetup.target After=multipathd.target Before=zfs-import.target ConditionPathExists=!@sysconfdir@/zfs/zpool.cache +ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes -ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules ExecStart=@sbindir@/zpool import -aN -o cachefile=none [Install] diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index e0d4bb37f..480f39a49 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -7,11 +7,11 @@ After=zfs-import.target After=systemd-remount-fs.service Before=local-fs.target Before=systemd-random-seed.service +ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes -ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules ExecStart=@sbindir@/zfs mount -a [Install] |