aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Hüdepohl <[email protected]>2021-01-26 21:14:22 +0100
committerBrian Behlendorf <[email protected]>2021-02-05 11:40:33 -0800
commit07ca7592ad0ef60d22b8155eeae1cc9bc69a528f (patch)
treebf02e12c23ec8f5a1399bc377435bf2745c8b3ae
parentfb0d8074778af9f12b0e84472d509eac2aa52dd0 (diff)
dracut: Fix race condition between load-key and import
zfs-load-key.sh is called by the dracut-pre-mount.service unit which has no explicit 'After' dependency on zfs-import.target. That way it can be that the pool has not yet been imported and the zfs-load-key.sh finishes without ever seeing the relevant pool. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Lorenz Hüdepohl <[email protected]> Closes #11500
-rwxr-xr-xcontrib/dracut/90zfs/zfs-generator.sh.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in
index 59cdadcbe..12293bd24 100755
--- a/contrib/dracut/90zfs/zfs-generator.sh.in
+++ b/contrib/dracut/90zfs/zfs-generator.sh.in
@@ -59,4 +59,12 @@ echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysr
[ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
+
+[ -d "$GENERATOR_DIR"/dracut-pre-mount.service.d ] || mkdir "$GENERATOR_DIR"/dracut-pre-mount.service.d
+
+{
+ echo "[Unit]"
+ echo "After=zfs-import.target"
+} > "$GENERATOR_DIR"/dracut-pre-mount.service.d/zfs-enhancement.conf
+
echo "zfs-generator: finished" >> /dev/kmsg