From cbbd4428ac12a56ac560410f190ea854562896f2 Mon Sep 17 00:00:00 2001 From: WANG Chao Date: Mon, 16 Sep 2013 15:46:58 +0800 Subject: [PATCH] dracut-module-setup: _dev to be a local variable In kdump_setup_bridge/bond/team(), we use _dev as a global variable. That causes following issues when network is br0 over bond0: -> kdump_setup_bridge br0: _dev to be "bond0" as a brif -> kdump_setup_bond bond0: _dev is modified to be eth0 as a bond slave -> (jump back) kdump_setup_bridge br0: we really need _dev is "bond0" not "eth0". _dev must be a local variable because it has been used multiple places. Signed-off-by: WANG Chao Acked-by: Vivek Goyal Acked-by: Dave Young --- dracut-module-setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 517099c..f49f7fe 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -96,7 +96,7 @@ kdump_get_perm_addr() { kdump_setup_bridge() { local _netdev=$1 - local _brif="" + local _brif _dev for _dev in `ls /sys/class/net/$_netdev/brif/`; do if kdump_is_bond "$_dev"; then kdump_setup_bond "$_dev" @@ -114,6 +114,7 @@ kdump_setup_bridge() { kdump_setup_bond() { local _netdev=$1 + local _dev for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/42bond.conf done @@ -126,7 +127,7 @@ kdump_setup_bond() { kdump_setup_team() { local _netdev=$1 - local slaves="" + local slaves _dev for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/44team.conf slaves+="$_dev,"