From 240f09451bcb21569c68c06ace8d7be46d25ed37 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 2 Apr 2014 10:05:15 +0200 Subject: [PATCH] dracut-037-10.git20140402 - fixed fstab.sys with systemd - DHCPv6 fixes - dm-cache module now included - FCoE fixes --- 0003-fcoe-wait-for-lldpad-to-be-ready.patch | 44 ++++++++++ ...k-handle-ip-dhcp6-for-all-interfaces.patch | 28 +++++++ 0005-lsinitrd.sh-prevent-construct.patch | 83 +++++++++++++++++++ ...HPv6-set-valid_lft-and-preferred_lft.patch | 35 ++++++++ 0007-dm-add-dm-cache-modules.patch | 23 +++++ 0008-fcoe-workaround-fcoe-timing-issues.patch | 55 ++++++++++++ ...nt-and-fsck-from-fstab-if-using-syst.patch | 36 ++++++++ dracut.spec | 15 +++- 8 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 0003-fcoe-wait-for-lldpad-to-be-ready.patch create mode 100644 0004-network-handle-ip-dhcp6-for-all-interfaces.patch create mode 100644 0005-lsinitrd.sh-prevent-construct.patch create mode 100644 0006-network-DCHPv6-set-valid_lft-and-preferred_lft.patch create mode 100644 0007-dm-add-dm-cache-modules.patch create mode 100644 0008-fcoe-workaround-fcoe-timing-issues.patch create mode 100644 0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch diff --git a/0003-fcoe-wait-for-lldpad-to-be-ready.patch b/0003-fcoe-wait-for-lldpad-to-be-ready.patch new file mode 100644 index 0000000..614caab --- /dev/null +++ b/0003-fcoe-wait-for-lldpad-to-be-ready.patch @@ -0,0 +1,44 @@ +From 3aaf6ccc837d7e16fa8c0c259d107832a578ff89 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Mar 2014 15:28:19 +0100 +Subject: [PATCH] fcoe: wait for lldpad to be ready + +--- + modules.d/95fcoe/fcoe-up.sh | 10 ++++++++-- + modules.d/95fcoe/module-setup.sh | 2 +- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh +index 511c554..dd45358 100755 +--- a/modules.d/95fcoe/fcoe-up.sh ++++ b/modules.d/95fcoe/fcoe-up.sh +@@ -28,8 +28,14 @@ if [ "$dcb" = "dcb" ]; then + # are to kill it and start a new lldpad to take over. Data is transfered + # between the 2 using a shm segment + lldpad -d +- # stupid tools, need sleep +- sleep 1 ++ # wait for lldpad to be ready ++ i=0 ++ while [ $i -lt 60 ]; do ++ lldptool -p && break ++ info "Waiting for lldpad to be ready" ++ sleep 1 ++ i=$(($i+1)) ++ done + dcbtool sc "$netif" dcb on + sleep 1 + dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 +diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh +index c502ba0..9a52c00 100755 +--- a/modules.d/95fcoe/module-setup.sh ++++ b/modules.d/95fcoe/module-setup.sh +@@ -21,7 +21,7 @@ installkernel() { + + # called by dracut + install() { +- inst_multiple ip dcbtool fipvlan lldpad readlink ++ inst_multiple ip dcbtool fipvlan lldpad readlink lldptool + + mkdir -m 0755 -p "$initdir/var/lib/lldpad" + diff --git a/0004-network-handle-ip-dhcp6-for-all-interfaces.patch b/0004-network-handle-ip-dhcp6-for-all-interfaces.patch new file mode 100644 index 0000000..1b44804 --- /dev/null +++ b/0004-network-handle-ip-dhcp6-for-all-interfaces.patch @@ -0,0 +1,28 @@ +From 2c7f7a337a8adeaa052274aa4b59bb25b90d1ea5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Mar 2014 15:39:56 +0100 +Subject: [PATCH] network: handle "ip=dhcp6" for all interfaces + +https://bugzilla.redhat.com/show_bug.cgi?id=1064365 +--- + modules.d/40network/ifup.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 51b0d52..ede0188 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -364,7 +364,12 @@ fi + + # no ip option directed at our interface? + if [ ! -e /tmp/net.${netif}.up ]; then +- do_dhcp -4 ++ if getargs 'ip=dhcp6'; then ++ load_ipv6 ++ do_dhcp -6 ++ else ++ do_dhcp -4 ++ fi + fi + + exit 0 diff --git a/0005-lsinitrd.sh-prevent-construct.patch b/0005-lsinitrd.sh-prevent-construct.patch new file mode 100644 index 0000000..b2e21af --- /dev/null +++ b/0005-lsinitrd.sh-prevent-construct.patch @@ -0,0 +1,83 @@ +From fd9f902477a8d8df6ce0fa1b044484c435fff247 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 27 Mar 2014 09:27:53 +0100 +Subject: [PATCH] lsinitrd.sh: prevent < <$() construct +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Running dracut in a chroot environment, which has /dev not correctly +setup will result in errors like: + +/usr/bin/lsinitrd: line 164: /dev/fd/62: No such file or directory +cpio: Malformed number �5�OK�� +cpio: Malformed number 5�OK�� +cpio: Malformed number �OK�� + +This is because bash wants /dev/fd/ for constructs like: +foo < <$(bar) +--- + lsinitrd.sh | 50 +++++++++++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 21 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 8dc9032..a697bc2 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -160,27 +160,35 @@ case $bin in + ;; + esac + +-if [[ $SKIP ]]; then +- read -N 6 bin < <($SKIP "$image") +-fi +- +-case $bin in +- $'\x1f\x8b'*) +- CAT="zcat --";; +- BZh*) +- CAT="bzcat --";; +- $'\x71\xc7'*|070701) +- CAT="cat --" +- ;; +- $'\x02\x21'*) +- CAT="lz4 -d -c";; +- *) +- CAT="xzcat --"; +- if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then +- CAT="xzcat --single-stream --" +- fi +- ;; +-esac ++CAT=$({ ++ if [[ $SKIP ]]; then ++ $SKIP "$image" ++ else ++ cat "$image" ++ fi } | { ++ read -N 6 bin ++ case $bin in ++ $'\x1f\x8b'*) ++ echo "zcat --" ++ ;; ++ BZh*) ++ echo "bzcat --" ++ ;; ++ $'\x71\xc7'*|070701) ++ echo "cat --" ++ ;; ++ $'\x02\x21'*) ++ echo "lz4 -d -c" ++ ;; ++ *) ++ if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then ++ echo "xzcat --single-stream --" ++ else ++ echo "xzcat --" ++ fi ++ ;; ++ esac ++ }) + + skipcpio() + { diff --git a/0006-network-DCHPv6-set-valid_lft-and-preferred_lft.patch b/0006-network-DCHPv6-set-valid_lft-and-preferred_lft.patch new file mode 100644 index 0000000..5c22433 --- /dev/null +++ b/0006-network-DCHPv6-set-valid_lft-and-preferred_lft.patch @@ -0,0 +1,35 @@ +From ebe7411691fb01c278c088e74e9ca32453cc1370 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 27 Mar 2014 12:31:23 +0100 +Subject: [PATCH] network: DCHPv6: set valid_lft and preferred_lft + +https://bugzilla.redhat.com/show_bug.cgi?id=1064365 +--- + modules.d/40network/dhclient-script.sh | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 50e8932..ba05250 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -64,13 +64,17 @@ setup_interface6() { + search=$(printf -- "$new_domain_search") + namesrv=$new_domain_name_servers + hostname=$new_host_name +- lease_time=$new_dhcp_lease_time ++ [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time ++ [ -n "$new_max_life" ] && lease_time=$new_max_life ++ preferred_lft=$lease_time ++ [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life + + [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override + + ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \ +- dev ${netif} scope global valid_lft ${lease_time} \ +- preferred_lft ${lease_time} ++ dev ${netif} scope global \ ++ ${lease_time:+valid_lft $lease_time} \ ++ ${preferred_lft:+preferred_lft ${preferred_lft}} + + [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf + if [ -n "$namesrv" ] ; then diff --git a/0007-dm-add-dm-cache-modules.patch b/0007-dm-add-dm-cache-modules.patch new file mode 100644 index 0000000..d1254d7 --- /dev/null +++ b/0007-dm-add-dm-cache-modules.patch @@ -0,0 +1,23 @@ +From 37502d2733c8ba8bc0d93e6f126534f23111fc3e Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 27 Mar 2014 12:34:40 +0100 +Subject: [PATCH] dm: add dm-cache modules + +https://bugzilla.redhat.com/show_bug.cgi?id=1081435 +--- + modules.d/90dm/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh +index 829c24b..2367588 100755 +--- a/modules.d/90dm/module-setup.sh ++++ b/modules.d/90dm/module-setup.sh +@@ -16,7 +16,7 @@ depends() { + # called by dracut + installkernel() { + instmods =drivers/md +- instmods dm_mod ++ instmods dm_mod dm-cache dm-cache-mq dm-cache-cleaner + } + + # called by dracut diff --git a/0008-fcoe-workaround-fcoe-timing-issues.patch b/0008-fcoe-workaround-fcoe-timing-issues.patch new file mode 100644 index 0000000..5994a8d --- /dev/null +++ b/0008-fcoe-workaround-fcoe-timing-issues.patch @@ -0,0 +1,55 @@ +From 3c530fc528d61ea2701dfb46ccd90e218a6d8aef Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 31 Mar 2014 16:21:49 +0200 +Subject: [PATCH] fcoe: workaround fcoe timing issues + +--- + modules.d/95fcoe/fcoe-genrules.sh | 2 +- + modules.d/95fcoe/fcoe-up.sh | 23 ++++++++++++++++++++--- + 2 files changed, 21 insertions(+), 4 deletions(-) + +diff --git a/modules.d/95fcoe/fcoe-genrules.sh b/modules.d/95fcoe/fcoe-genrules.sh +index 80894ed..fa3af6d 100755 +--- a/modules.d/95fcoe/fcoe-genrules.sh ++++ b/modules.d/95fcoe/fcoe-genrules.sh +@@ -13,4 +13,4 @@ + else + printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb" + fi +-} > /etc/udev/rules.d/92-fcoe.rules ++} >> /etc/udev/rules.d/92-fcoe.rules +diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh +index dd45358..d8c73c8 100755 +--- a/modules.d/95fcoe/fcoe-up.sh ++++ b/modules.d/95fcoe/fcoe-up.sh +@@ -36,10 +36,27 @@ if [ "$dcb" = "dcb" ]; then + sleep 1 + i=$(($i+1)) + done +- dcbtool sc "$netif" dcb on +- sleep 1 +- dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 ++ ++ # on some systems lldpad needs some time ++ # sleep until we find a better solution ++ sleep 30 ++ ++ while [ $i -lt 60 ]; do ++ dcbtool sc "$netif" dcb on && break ++ info "Retrying to turn dcb on" ++ sleep 1 ++ i=$(($i+1)) ++ done ++ ++ while [ $i -lt 60 ]; do ++ dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break ++ info "Retrying to turn fcoe on" ++ sleep 1 ++ i=$(($i+1)) ++ done ++ + sleep 1 ++ + fipvlan "$netif" -c -s + elif [ "$netdriver" = "bnx2x" ]; then + # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan diff --git a/0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch b/0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch new file mode 100644 index 0000000..3704259 --- /dev/null +++ b/0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch @@ -0,0 +1,36 @@ +From e920bfb1e8a5917e7b0f360d1c51d200db3acbfd Mon Sep 17 00:00:00 2001 +From: WANG Chao +Date: Tue, 1 Apr 2014 15:20:49 +0800 +Subject: [PATCH] fstab: do not mount and fsck from fstab if using systemd + +If using systemd in initramfs, we could run into a race condition when +dracut and systemd both are trying to mount and run fsck for the same +filesystem, and mount or fsck could be a failure. + +To fix such failure, we should use systemd to mount/fsck from /etc/fstab +only. + +v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy + +Signed-off-by: WANG Chao +--- + modules.d/95fstab-sys/mount-sys.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh +index 12711a0..a237810 100755 +--- a/modules.d/95fstab-sys/mount-sys.sh ++++ b/modules.d/95fstab-sys/mount-sys.sh +@@ -27,7 +27,11 @@ fstab_mount() { + return 0 + } + +-[ -f /etc/fstab ] && fstab_mount /etc/fstab ++# systemd will mount and run fsck from /etc/fstab and we don't want to ++# run into a race condition. ++if [ -z "$DRACUT_SYSTEMD" ]; then ++ [ -f /etc/fstab ] && fstab_mount /etc/fstab ++fi + + # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys + if [ -f $NEWROOT/etc/fstab.sys ]; then diff --git a/dracut.spec b/dracut.spec index 422db30..287538b 100644 --- a/dracut.spec +++ b/dracut.spec @@ -11,7 +11,7 @@ Name: dracut Version: 037 -Release: 3.git20140320%{?dist} +Release: 10.git20140402%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -32,6 +32,13 @@ URL: https://dracut.wiki.kernel.org/ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz Patch1: 0001-dracut-initramfs-restore-fix-unpacking-with-early-mi.patch Patch2: 0002-systemd-add-systemd-gpt-auto-generator.patch +Patch3: 0003-fcoe-wait-for-lldpad-to-be-ready.patch +Patch4: 0004-network-handle-ip-dhcp6-for-all-interfaces.patch +Patch5: 0005-lsinitrd.sh-prevent-construct.patch +Patch6: 0006-network-DCHPv6-set-valid_lft-and-preferred_lft.patch +Patch7: 0007-dm-add-dm-cache-modules.patch +Patch8: 0008-fcoe-workaround-fcoe-timing-issues.patch +Patch9: 0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch BuildRequires: bash git @@ -480,6 +487,12 @@ rm -rf -- $RPM_BUILD_ROOT %endif %changelog +* Wed Apr 02 2014 Harald Hoyer 037-10.git20140402 +- fixed fstab.sys with systemd +- DHCPv6 fixes +- dm-cache module now included +- FCoE fixes + * Thu Mar 20 2014 Harald Hoyer 037-3.git20140320 - fixed dracut-initramfs-restore with microcode