Skip to content

Commit d77523a

Browse files
lhuedepohljsai20
authored andcommitted
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 openzfs#11500
1 parent f248d10 commit d77523a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contrib/dracut/90zfs/zfs-generator.sh.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,12 @@ echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysr
5959
[ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
6060
ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
6161

62+
63+
[ -d "$GENERATOR_DIR"/dracut-pre-mount.service.d ] || mkdir "$GENERATOR_DIR"/dracut-pre-mount.service.d
64+
65+
{
66+
echo "[Unit]"
67+
echo "After=zfs-import.target"
68+
} > "$GENERATOR_DIR"/dracut-pre-mount.service.d/zfs-enhancement.conf
69+
6270
echo "zfs-generator: finished" >> /dev/kmsg

0 commit comments

Comments
 (0)