1de2d2
From 96fc660c9170fbea5ac80235ab7d0e7cfdbe243e Mon Sep 17 00:00:00 2001
1de2d2
From: Martin Wilck <mwilck@suse.de>
1de2d2
Date: Thu, 21 Mar 2019 16:27:04 +0100
1de2d2
Subject: [PATCH] iscsi: don't continue waiting if the root device is present
1de2d2
1de2d2
dracut waits for every iscsiroot connection to be established
1de2d2
before switching root. This is not necessary in multipath scenarios,
1de2d2
where a single path is usually sufficient to set up the root device,
1de2d2
and where users expect booting to succeed unless all paths are down.
1de2d2
1de2d2
Don't wait for the iscsi portal to start if the root device has
1de2d2
already been found.
1de2d2
---
1de2d2
 modules.d/95iscsi/parse-iscsiroot.sh | 4 ++--
1de2d2
 1 file changed, 2 insertions(+), 2 deletions(-)
1de2d2
1de2d2
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
1de2d2
index f00a83bb..8d6e3e8c 100755
1de2d2
--- a/modules.d/95iscsi/parse-iscsiroot.sh
1de2d2
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
1de2d2
@@ -84,7 +84,7 @@ if [ -n "$iscsi_firmware" ]; then
1de2d2
     modprobe -b -q iscsi_boot_sysfs 2>/dev/null
1de2d2
     modprobe -b -q iscsi_ibft
1de2d2
     # if no ip= is given, but firmware
1de2d2
-    echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
1de2d2
+    echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
1de2d2
     initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
1de2d2
     initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
1de2d2
     initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
1de2d2
@@ -145,7 +145,7 @@ for nroot in $(getargs netroot); do
1de2d2
     type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
1de2d2
     parse_iscsi_root "$nroot" || return 1
1de2d2
     netroot_enc=$(str_replace "$nroot" '/' '\2f')
1de2d2
-    echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
1de2d2
+    echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
1de2d2
 done
1de2d2
 
1de2d2
 # Done, all good!
1de2d2