Skip to content

Commit

Permalink
dracut: Fix race condition between load-key and import
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
Closes openzfs#11500
  • Loading branch information
lhuedepohl authored and jsai20 committed Mar 30, 2021
1 parent f248d10 commit d77523a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contrib/dracut/90zfs/zfs-generator.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d77523a

Please sign in to comment.