Skip to contentSkip to conversation

Some tiny fixes

PATCH In review Thomas Renninger 4 participants 11 messages Mar 23, 2015 – Jun 2, 2015 6 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

would be great if these can be applied in the mainline dracut git tree.

Thanks,

Thomas

#2 lore raw

PATCH 1/4 Correct paths for openSUSE

In reply to a message not in the archive

From: Christian Rodrigues <[email protected]>

openSUSE has things stored in different places, so fixup the paths here.

---
 dracut.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dracut.sh +1 -1
index 17bf8f2..1aa7d31 100755
@@ -809,7 +809,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
 [[ $lvmconf_l ]] && lvmconf=$lvmconf_l
 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
-[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
+[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel"
 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
 [[ $tmpdir ]] || tmpdir=/var/tmp
 [[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
Signature · 1 line
2.1.4
#5 lore raw

PATCH 2/4 40network: Fix race condition when wait for networks

In reply to a message not in the archive

From: Pawel Wieczorkiewicz <[email protected]>

If no network related params are specific, but rd.neednet=1 is set, the default initqueue action is to wait until one of the network interfaces is marked as setup properly.

This also help with initqueue's race condition when the network interface shows upd late

References: bnc#866771

---
 modules.d/40network/net-genrules.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
modules.d/40network/net-genrules.sh +4 -1
index 77e47b5..2c955b7 100755
@@ -95,7 +95,10 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
     else
         cond='ACTION=="add", SUBSYSTEM=="net"'
         # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
-        echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
+        if [ "$NEEDNET" = "1" ]; then
+            echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
+            echo "[ -f /tmp/net.*.did-setup ]" >$hookdir/initqueue/finished/wait-network.sh
+        fi
     fi
 
 # if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
Signature · 1 line
2.1.4
#10 lore raw

PATCH 3/4 40network: always start netroot in ifup.sh

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

It's totally irrelevant how the network is configured when trying to setup netroot. It only matters if it could be configured at all.
So change the logic the check for correct network setup and then start netroot.

References: bnc#881235

---
 modules.d/40network/ifup.sh | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
modules.d/40network/ifup.sh +8 -14
index de518b6..9af5474 100755
@@ -338,21 +338,15 @@ for p in $(getargs ip=); do
         esac
     done
 
-    > /tmp/net.${netif}.up
+    if [ $? -eq 0 ]; then
+        > /tmp/net.${netif}.up
 
-    case $autoconf in
-        dhcp|on|any|dhcp6)
-            ;;
-        *)
-            if [ $? -eq 0 ]; then
-                setup_net $netif
-                source_hook initqueue/online $netif
-                if [ -z "$manualup" ]; then
-                    /sbin/netroot $netif
-                fi
-            fi
-            ;;
-    esac
+        setup_net $netif
+        source_hook initqueue/online $netif
+        if [ -z "$manualup" ]; then
+            /sbin/netroot $netif
+        fi
+    fi
 
     exit 0
 done
Signature · 1 line
2.1.4
#13 lore raw

PATCH 4/4 95fcoe-uefi: Test for EFI firmware

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

The fcoe-uefi module should test for EFI firmware when called in 'hostonly' mode; of no EFI firmware is found then the module doesn't need to be included.

References: bnc#882412

---
 modules.d/95fcoe-uefi/module-setup.sh | 3 +++
 1 file changed, 3 insertions(+)
modules.d/95fcoe-uefi/module-setup.sh +3 -0
index 8b8c810..5d8477c 100755
@@ -2,6 +2,9 @@
 
 # called by dracut
 check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        [ -d /sys/firmware/efi ] || return 255
+    }
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
     return 0
 }
Signature · 1 line
2.1.4
#7 lore raw

Re: [PATCH 2/4] 40network: Fix race condition when wait for networks

In reply to a message not in the archive
Quoted 22 lines · Thomas Renninger

From: Pawel Wieczorkiewicz <[email protected]>

If no network related params are specific, but rd.neednet=1 is set, the default initqueue action is to wait until one of the network interfaces is marked as setup properly.

This also help with initqueue's race condition when the network interface shows upd late

References: bnc#866771

---
 modules.d/40network/net-genrules.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
modules.d/40network/net-genrules.sh +0 -0
index 77e47b5..2c955b7 100755

modules.d/40network/net-genrules.sh command -v fix_bootif >/dev/null || . /lib/net-lib.sh · line 100

Quoted 7 lines
modules.d/40network/net-genrules.sh +3 -1
@@ -95,7 +95,10 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
     else
         cond='ACTION=="add", SUBSYSTEM=="net"'
         # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
-        echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
+        if [ "$NEEDNET" = "1" ]; then
+            echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
+            echo "[ -f /tmp/net.*.did-setup ]" >$hookdir/initqueue/finished/wait-network.sh

err, if multiple networks are up, [ -f /tmp/net.*.did-setup ] is not correct shell syntax.

$ [ -e /dev/* ] && echo OK
bash: [: too many arguments
Quoted 5 lines
modules.d/40network/net-genrules.sh +1 -0
+        fi
     fi
 
 # if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
#12 lore raw

Re: [PATCH 3/4] 40network: always start netroot in ifup.sh

In reply to a message not in the archive
Quoted 41 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

It's totally irrelevant how the network is configured when trying to setup netroot. It only matters if it could be configured at all.
So change the logic the check for correct network setup and then start netroot.

References: bnc#881235

---
 modules.d/40network/ifup.sh | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
modules.d/40network/ifup.sh +2 -13
index de518b6..9af5474 100755
@@ -338,21 +338,15 @@ for p in $(getargs ip=); do
         esac
     done
 
-    > /tmp/net.${netif}.up
+    if [ $? -eq 0 ]; then
+        > /tmp/net.${netif}.up
 
-    case $autoconf in
-        dhcp|on|any|dhcp6)
-            ;;
-        *)
-            if [ $? -eq 0 ]; then
-                setup_net $netif
-                source_hook initqueue/online $netif
-                if [ -z "$manualup" ]; then
-                    /sbin/netroot $netif
-                fi
-            fi
-            ;;

modules.d/40network/ifup.sh for p in $(getargs ip=); do · line 352

Quoted 10 lines
modules.d/40network/ifup.sh +6 -1
-    esac
+        setup_net $netif
+        source_hook initqueue/online $netif
+        if [ -z "$manualup" ]; then
+            /sbin/netroot $netif
+        fi
+    fi
 
     exit 0
 done

Well, for dhcp, the dhclient-script.sh adds an initqueue script setup_net_$netif.sh, which does:

. /lib/net-lib.sh
setup_net $netif
source_hook initqueue/online $netif
/sbin/netroot $netif

#4 lore raw

Re: [PATCH 1/4] Correct paths for openSUSE

In reply to a message not in the archive
Quoted 18 lines · Thomas Renninger

From: Christian Rodrigues <[email protected]>

openSUSE has things stored in different places, so fixup the paths here.

---
 dracut.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dracut.sh +0 -0
index 17bf8f2..1aa7d31 100755

dracut.sh stdloglvl=$((stdloglvl + verbosity_mod_l)) · line 815

Quoted 8 lines
dracut.sh +1 -1
@@ -809,7 +809,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
 [[ $lvmconf_l ]] && lvmconf=$lvmconf_l
 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
-[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
+[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel"
 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
 [[ $tmpdir ]] || tmpdir=/var/tmp
 [[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS

pushed, thanks

#16 lore raw

Re: [PATCH 4/4] 95fcoe-uefi: Test for EFI firmware

In reply to a message not in the archive
Quoted 20 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

The fcoe-uefi module should test for EFI firmware when called in 'hostonly' mode; of no EFI firmware is found then the module doesn't need to be included.

References: bnc#882412

---
 modules.d/95fcoe-uefi/module-setup.sh | 3 +++
 1 file changed, 3 insertions(+)
modules.d/95fcoe-uefi/module-setup.sh +0 -0
index 8b8c810..5d8477c 100755

modules.d/95fcoe-uefi/module-setup.sh line 10

Quoted 9 lines
modules.d/95fcoe-uefi/module-setup.sh +3 -0
@@ -2,6 +2,9 @@
 
 # called by dracut
 check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        [ -d /sys/firmware/efi ] || return 255
+    }
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
     return 0
 }

pushed, thanks

#9 lore raw

Re: [PATCH 2/4] 40network: Fix race condition when wait for networks

In reply to a message not in the archive
Quoted 9 lines · On Tue, 02 Jun 2015 12:15:26 +0200 Harald Hoyer…
Quoted 2 lines

+ echo "[ -f /tmp/net.*.did-setup ]"

Quoted 1 line

$hookdir/initqueue/finished/wait-network.sh

err, if multiple networks are up, [ -f /tmp/net.*.did-setup ] is not correct shell syntax.

$ [ -e /dev/* ] && echo OK
bash: [: too many arguments

Can this condition really occur?
Shouldn't we be done with the wait-network initqueue job condition just after 1st network is setup (the '*' here just means whatever interface is up, not multiple interfaces)?

AFAIR each network ifup request is a separate initqueue job and the condition is evaluated between jobs switches. So first created /tmp/net.*.did-setup, whatever interface it has, makes this condition be satisfied.

This way or another, it can be improved to the longer and more demanding multifiles variant (for file in /tmp/net.*.did-setup loop or set -- /tmp/net.*.did-setup and $# > 0 evaluation).

Signature · 6 lines
Best Regards,
Pawel Wieczorkiewicz <[email protected]>, Linux System Developer

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu,
Graham Norton, HRB 21284 (AG Nürnberg) Maxfeldstraße 5 / 90409
Nürnberg / Germany / Phone: +49-911-740 53 - 613