]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zfs-import-{cache,scan}: change condition to FileNotEmpty
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Fri, 5 Feb 2021 19:25:22 +0000 (20:25 +0100)
committerGitHub <noreply@github.com>
Fri, 5 Feb 2021 19:25:22 +0000 (11:25 -0800)
When all pools are exported ZFS will generate an empty cache file.
This will cause the import service to fail, which is sub-optimal,
since this means that dracut fails, and it necessary to run
`zpool import -a` to boot, delete the file, and regenerate+reinstall
the initrd.

This resolves the issue by treating an zero-length cache files the
same as a missing cache file.  This aligns the behavior with that
of the `zpool` command itself.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11568

etc/systemd/system/zfs-import-cache.service.in
etc/systemd/system/zfs-import-scan.service.in

index 47c5b07f8ff0315485320c2ed00aae1df812f8af..0d236fe9e468d63359ad3ee782b4e69b12369102 100644 (file)
@@ -8,7 +8,7 @@ After=cryptsetup.target
 After=multipathd.target
 After=systemd-remount-fs.service
 Before=zfs-import.target
-ConditionPathExists=@sysconfdir@/zfs/zpool.cache
+ConditionFileNotEmpty=@sysconfdir@/zfs/zpool.cache
 ConditionPathIsDirectory=/sys/module/zfs
 
 [Service]
index 6520f32463dd405ad15aa720fd51de24bf08600e..f0317e23e508578b3c4e23d8d0dd098467685380 100644 (file)
@@ -7,7 +7,7 @@ After=systemd-udev-settle.service
 After=cryptsetup.target
 After=multipathd.target
 Before=zfs-import.target
-ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
+ConditionFileNotEmpty=!@sysconfdir@/zfs/zpool.cache
 ConditionPathIsDirectory=/sys/module/zfs
 
 [Service]