Skip to content

Commit

Permalink
Verify zfs module loaded before starting services
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Jonathon Fernyhough <[email protected]>
Closes openzfs#10627
  • Loading branch information
jonathonf authored Jul 29, 2020
1 parent 27d96d2 commit ae12b02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-import-cache.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ConditionPathExists=@sysconfdir@/zfs/zpool.cache
[Service]
Type=oneshot
RemainAfterExit=yes
ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules
ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN

[Install]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-import-scan.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
[Service]
Type=oneshot
RemainAfterExit=yes
ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules
ExecStart=@sbindir@/zpool import -aN -o cachefile=none

[Install]
Expand Down
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-mount.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Before=systemd-random-seed.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecCondition=/usr/bin/grep -q "^zfs " /proc/modules
ExecStart=@sbindir@/zfs mount -a

[Install]
Expand Down

0 comments on commit ae12b02

Please sign in to comment.