diff --git a/0595-iscsi-don-t-continue-waiting-if-the-root-device-is-p.patch b/0595-iscsi-don-t-continue-waiting-if-the-root-device-is-p.patch new file mode 100644 index 0000000..7ac47cf --- /dev/null +++ b/0595-iscsi-don-t-continue-waiting-if-the-root-device-is-p.patch @@ -0,0 +1,42 @@ +From 06d95ed6eb72ad9b1a4666b3d7cb6977e5b83ca5 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 21 Mar 2019 16:27:04 +0100 +Subject: [PATCH 1/6] iscsi: don't continue waiting if the root device is + present + +dracut waits for every iscsiroot connection to be established +before switching root. This is not necessary in multipath scenarios, +where a single path is usually sufficient to set up the root device, +and where users expect booting to succeed unless all paths are down. + +Don't wait for the iscsi portal to start if the root device has +already been found. +--- + modules.d/95iscsi/parse-iscsiroot.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index f884e684..b96605ef 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -84,7 +84,7 @@ if [ -n "$iscsi_firmware" ]; then + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft + # if no ip= is given, but firmware +- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh + initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT" + initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT" + initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'" +@@ -147,7 +147,7 @@ for nroot in $(getargs netroot); do + type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh + parse_iscsi_root "$nroot" || return 1 + netroot_enc=$(str_replace "$nroot" '/' '\2f') +- echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh + done + + # Done, all good! +-- +2.16.4 + diff --git a/0596-network-stop-waiting-for-interfaces-if-root-device-i.patch b/0596-network-stop-waiting-for-interfaces-if-root-device-i.patch new file mode 100644 index 0000000..427c41b --- /dev/null +++ b/0596-network-stop-waiting-for-interfaces-if-root-device-i.patch @@ -0,0 +1,26 @@ +From 9aeceb14e010d68f8ee92f60664eef39d57552c2 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 21 Mar 2019 21:31:15 +0100 +Subject: [PATCH 2/6] network: stop waiting for interfaces if root device is + present + +--- + modules.d/40network/net-genrules.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh +index 843bd988..a5a9ae22 100755 +--- a/modules.d/40network/net-genrules.sh ++++ b/modules.d/40network/net-genrules.sh +@@ -86,7 +86,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + + for iface in $wait_ifaces; do + if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then +- echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh + fi + done + # Default: We don't know the interface to use, handle all +-- +2.16.4 + diff --git a/0597-iscsiroot-parse_iscsi_root-overwrites-command-line-a.patch b/0597-iscsiroot-parse_iscsi_root-overwrites-command-line-a.patch new file mode 100644 index 0000000..2d60e45 --- /dev/null +++ b/0597-iscsiroot-parse_iscsi_root-overwrites-command-line-a.patch @@ -0,0 +1,38 @@ +From a9ef0960799ad8d95de2e13a9f8773e88826e83e Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 15:29:04 +0200 +Subject: [PATCH 3/6] iscsiroot: parse_iscsi_root overwrites command line args + +iscsi_target_name, iscsi_target_ip, iscsi_target_port are +unconditionally overwritten by parse_iscsi_root. Don't set +them here, for code clarity. +--- + modules.d/95iscsi/iscsiroot.sh | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +Index: dracut-044/modules.d/95iscsi/iscsiroot.sh +=================================================================== +--- dracut-044.orig/modules.d/95iscsi/iscsiroot.sh ++++ dracut-044/modules.d/95iscsi/iscsiroot.sh +@@ -102,12 +102,6 @@ handle_netroot() + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) + [ -n "$arg" ] && iscsi_initiator=$arg +- arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=) +- [ -n "$arg" ] && iscsi_target_name=$arg +- arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip) +- [ -n "$arg" ] && iscsi_target_ip=$arg +- arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=) +- [ -n "$arg" ] && iscsi_target_port=$arg + arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=) + [ -n "$arg" ] && iscsi_target_group=$arg + arg=$(getarg rd.iscsi.username -d iscsi_username=) +@@ -122,6 +116,8 @@ handle_netroot() + iscsi_param="$iscsi_param $p" + done + ++ # this sets iscsi_target_name and possibly overwrites most ++ # parameters read from the command line above + parse_iscsi_root "$1" || return 1 + + # Bail out early, if there is no route to the destination diff --git a/0598-iscsiroot-there-s-never-more-than-one-target-per-cal.patch b/0598-iscsiroot-there-s-never-more-than-one-target-per-cal.patch new file mode 100644 index 0000000..2b2393d --- /dev/null +++ b/0598-iscsiroot-there-s-never-more-than-one-target-per-cal.patch @@ -0,0 +1,27 @@ +From 04657e60f00d53f52d47b7fd02b53618762340e4 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 15:40:14 +0200 +Subject: [PATCH 4/6] iscsiroot: there's never more than one target per call + +iscsi_target_name is set by iscsi_root, and thus can't have +more than one member. This allows us to get rid of one bashism +in iscsiroot.sh. +--- + modules.d/95iscsi/iscsiroot.sh | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +Index: dracut-044/modules.d/95iscsi/iscsiroot.sh +=================================================================== +--- dracut-044.orig/modules.d/95iscsi/iscsiroot.sh ++++ dracut-044/modules.d/95iscsi/iscsiroot.sh +@@ -221,8 +221,8 @@ handle_netroot() + [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 + fi + +- for target in $iscsi_target_name; do +- if [[ "$targets" =~ "$target" ]]; then ++ for target in $targets; do ++ if [ "$target" = "$iscsi_target_name" ]; then + if [ -n "$iscsi_iface_name" ]; then + $(iscsiadm -m iface -I $iscsi_iface_name --op=new) + [ -n "$iscsi_initiator" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.initiatorname --value=$iscsi_initiator) diff --git a/0599-iscsiroot-try-targets-only-once.patch b/0599-iscsiroot-try-targets-only-once.patch new file mode 100644 index 0000000..82a0fce --- /dev/null +++ b/0599-iscsiroot-try-targets-only-once.patch @@ -0,0 +1,37 @@ +From 1fd34ae26591701e27577e381dc284248e3bf6e2 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 16:16:40 +0200 +Subject: [PATCH 5/6] iscsiroot: try targets only once + +In multipath scenarios, "iscsiadm -m node" may contain +several records with the same target. +There's no point in trying "iscsiadm --login" multiple +time for the same target, through the same portal. + +Moreover, warn if the desired target is not on the node +list. +--- + modules.d/95iscsi/iscsiroot.sh | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +Index: dracut-044/modules.d/95iscsi/iscsiroot.sh +=================================================================== +--- dracut-044.orig/modules.d/95iscsi/iscsiroot.sh ++++ dracut-044/modules.d/95iscsi/iscsiroot.sh +@@ -97,7 +97,7 @@ handle_netroot() + local iscsi_in_username iscsi_in_password + local iscsi_iface_name iscsi_netdev_name + local iscsi_param param +- local p ++ local p found + + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) +@@ -221,6 +221,7 @@ handle_netroot() + [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 + fi + ++ found= + for target in $targets; do + if [ "$target" = "$iscsi_target_name" ]; then + if [ -n "$iscsi_iface_name" ]; then diff --git a/0600-iscsiroot-remove-bashisms.patch b/0600-iscsiroot-remove-bashisms.patch new file mode 100644 index 0000000..96f0c8a --- /dev/null +++ b/0600-iscsiroot-remove-bashisms.patch @@ -0,0 +1,69 @@ +From c14a550d54b408088fd0aa14a4f2088f8b45237e Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 17:12:07 +0200 +Subject: [PATCH 6/6] iscsiroot: remove bashisms + +According to the dracut README, module code to be run in +the initrd must be POSIX-compliant. Replace remaining +bashisms (as reported by checkbashisms) with POSIX compliant +code. + +The use of "type" is not strictly POSIX compliant, but it's +all over the place in dracut code. dash supports it, anyway. +--- + modules.d/95iscsi/iscsiroot.sh | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 73dd8c20..c00a9f58 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -61,11 +61,11 @@ handle_firmware() + if ! iscsiadm -m fw; then + warn "iscsiadm: Could not get list of targets from firmware." + else +- ifaces=( $(echo /sys/firmware/ibft/ethernet*) ) ++ ifaces=$(set -- /sys/firmware/ibft/ethernet*; echo $#) + retry=$(cat /tmp/session-retry) + +- if [ $retry -lt ${#ifaces[*]} ]; then +- let retry++ ++ if [ $retry -lt $ifaces ]; then ++ retry=$((retry+1)) + echo $retry > /tmp/session-retry + return 1 + else +@@ -95,6 +95,7 @@ handle_netroot() + local iscsi_iface_name iscsi_netdev_name + local iscsi_param param + local p found ++ local login_retry_max_seen= + + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) +@@ -110,7 +111,9 @@ handle_netroot() + arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=) + [ -n "$arg" ] && iscsi_in_password=$arg + for p in $(getargs rd.iscsi.param -d iscsi_param); do +- iscsi_param="$iscsi_param $p" ++ [ "${p%=*}" = node.session.initial_login_retry_max ] && \ ++ login_retry_max_seen=yes ++ iscsi_param="$iscsi_param $p" + done + + # this sets iscsi_target_name and possibly overwrites most +@@ -123,9 +126,8 @@ handle_netroot() + fi + + #limit iscsistart login retries +- if [[ ! "$iscsi_param" =~ "node.session.initial_login_retry_max" ]]; then +- set_login_retries +- retries=$? ++ if [ "$login_retry_max_seen" != yes ]; then ++ retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max) + if [ $retries -gt 0 ]; then + iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries" + fi +-- +2.16.4 + diff --git a/0601-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch b/0601-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch new file mode 100644 index 0000000..c43484f --- /dev/null +++ b/0601-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch @@ -0,0 +1,32 @@ +From 33348c63393d6fca3b6070dfdf108bff7b59d53b Mon Sep 17 00:00:00 2001 +From: Alexander Tsoy +Date: Tue, 5 Jan 2016 22:11:57 +0300 +Subject: [PATCH] base/dracut-lib.sh:dev_unit_name() guard against $dev + beginning with "-" + +crypt/parse-crypt.sh generate initqueue job which always call +dev_unit_name() with an argument beginning with "-". This results +in the following error: + +dracut-initqueue[307]: + systemd-escape -p -cfb4aa43-2f02-4c6b-a313-60ea99288087 +dracut-initqueue[307]: systemd-escape: invalid option -- 'c' +--- + modules.d/99base/dracut-lib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 89235b04..45ef31b6 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -874,7 +874,7 @@ dev_unit_name() + local dev="$1" + + if command -v systemd-escape >/dev/null; then +- systemd-escape -p "$dev" ++ systemd-escape -p -- "$dev" + return + fi + +-- +2.16.4 + diff --git a/dracut.changes b/dracut.changes index 3bfd3f7..f2145e5 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Thu Apr 25 23:40:25 UTC 2019 - Daniel Molkentin + +- dracut-lib.sh:dev_unit_name() guard against $dev beginning with "-" (bsc#1132448) + * adds 0601-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch + +------------------------------------------------------------------- +Wed Apr 24 08:52:33 UTC 2019 - Daniel Molkentin + +- 95iscsi: avoid error messages when building initrd, multipath timeouts + (bsc#1130114, bsc#1130107, bsc#1121238) + * adds 0595-iscsi-don-t-continue-waiting-if-the-root-device-is-p.patch + * adds 0596-network-stop-waiting-for-interfaces-if-root-device-i.patch + * adds 0597-iscsiroot-parse_iscsi_root-overwrites-command-line-a.patch + * adds 0598-iscsiroot-there-s-never-more-than-one-target-per-cal.patch + * adds 0599-iscsiroot-try-targets-only-once.patch + * adds 0600-iscsiroot-remove-bashisms.patch + ------------------------------------------------------------------- Thu Mar 14 15:42:45 UTC 2019 - Daniel Molkentin @@ -177,7 +195,7 @@ Thu Apr 19 11:51:07 UTC 2018 - daniel.molkentin@suse.com Thu Apr 19 11:36:26 UTC 2018 - daniel.molkentin@suse.com - 95nfs: If no server is configured, read BOOTSERVERADDR from wicked's leaseinf - (boo#1089332) + (bsc#1089332) * adds 0566-95nfs-If-no-server-is-configured-read-BOOTSERVERADDR.patch ------------------------------------------------------------------- Thu Apr 5 11:05:15 UTC 2018 - daniel.molkentin@suse.com diff --git a/dracut.spec b/dracut.spec index 4f3d960..5c1bf40 100644 --- a/dracut.spec +++ b/dracut.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # @@ -433,6 +433,14 @@ Patch592: 0592-95iscsi-handle-qedi-like-bnx2i.patch Patch593: 0593-dracut-only-copy-xattr-if-root.patch # Patch specific to SUSE, not upstream Patch594: 0594-Check-SUSE-kernel-module-dependencies-recursively.patch +# Patches 595-600 submitted upstream https://github.com/dracutdevs/dracut/pull/562 +Patch595: 0595-iscsi-don-t-continue-waiting-if-the-root-device-is-p.patch +Patch596: 0596-network-stop-waiting-for-interfaces-if-root-device-i.patch +Patch597: 0597-iscsiroot-parse_iscsi_root-overwrites-command-line-a.patch +Patch598: 0598-iscsiroot-there-s-never-more-than-one-target-per-cal.patch +Patch599: 0599-iscsiroot-try-targets-only-once.patch +Patch600: 0600-iscsiroot-remove-bashisms.patch +Patch601: 0601-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch BuildRequires: asciidoc BuildRequires: bash @@ -745,6 +753,13 @@ chmod a+x modules.d/95qeth_rules/module-setup.sh %patch592 -p1 %patch593 -p1 %patch594 -p1 +%patch595 -p1 +%patch596 -p1 +%patch597 -p1 +%patch598 -p1 +%patch599 -p1 +%patch600 -p1 +%patch601 -p1 %build %configure\