[PATCH] dracut-kdump: use POSIX shell syntax
by Xunlei Pang
kdump.sh may run under sh/dash in kdump kernel.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
dracut-kdump.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 67fc743..fd3e4ef 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -157,7 +157,7 @@ read_kdump_conf()
case "$config_opt" in
dracut_args)
config_val=$(get_dracut_args_target "$config_val")
- [[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
+ [ -n "$config_val" ] && add_dump_code "dump_fs $config_val"
;;
ext[234]|xfs|btrfs|minix|nfs)
add_dump_code "dump_fs $config_val"
--
1.8.3.1
6 years, 10 months
[PATCH] rename function kdump_to_udev_name
by Dave Young
kdump_to_udev_name function name cause confusion to people, change it to
kdump_get_persistent_dev which sounds better.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
This patch can be applied upon previous raw dump fix.
dracut-module-setup.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- kexec-tools.orig/dracut-module-setup.sh
+++ kexec-tools/dracut-module-setup.sh
@@ -32,7 +32,7 @@ depends() {
return 0
}
-kdump_to_udev_name() {
+kdump_get_persistent_dev() {
local dev="${1//\"/}"
case "$dev" in
@@ -397,7 +397,7 @@ default_dump_target_install_conf()
kdump_install_net "$_target"
_fstype="nfs"
else
- _target=$(kdump_to_udev_name $_target)
+ _target=$(kdump_get_persistent_dev $_target)
fi
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
@@ -447,11 +447,11 @@ kdump_install_conf() {
_val=$(strip_comments $_val)
case "$_opt" in
raw)
- _pdev=$(persistent_policy="by-id" kdump_to_udev_name $_val)
+ _pdev=$(persistent_policy="by-id" kdump_get_persistent_dev $_val)
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
;;
ext[234]|xfs|btrfs|minix)
- _pdev=$(kdump_to_udev_name $_val)
+ _pdev=$(kdump_get_persistent_dev $_val)
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
if is_atomic; then
adjust_bind_mount_path "$_val"
6 years, 10 months
[PATCH] Raw dump: use by-id as persistent policy in 2nd kernel
by Dave Young
Although we use by-id in mkdumprd as persistent policy for the dump target
checking, finally it is not used in kdump 2nd kernel because we call dracut
function in module-setup.sh without persistent policy specified that means
kdump will copy default "by-uuid" dev name.
Though by-uuid usually works and it is still better to fix it as raw disk
uuid make no sense.
Also do not need to call bind mount adjust function for raw dump, here add
another switch case for raw dump and cleanup the functions with short
variable names to keep code shorter.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
dracut-module-setup.sh | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
--- kexec-tools.orig/dracut-module-setup.sh
+++ kexec-tools/dracut-module-setup.sh
@@ -438,32 +438,38 @@ adjust_bind_mount_path()
#install kdump.conf and what user specifies in kdump.conf
kdump_install_conf() {
+ local _opt _val _pdev
sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf
- while read config_opt config_val;
+ while read _opt _val;
do
# remove inline comments after the end of a directive.
- config_val=$(strip_comments $config_val)
- case "$config_opt" in
- ext[234]|xfs|btrfs|minix|raw)
- sed -i -e "s#^$config_opt[[:space:]]\+$config_val#$config_opt $(kdump_to_udev_name $config_val)#" ${initdir}/tmp/$$-kdump.conf
+ _val=$(strip_comments $_val)
+ case "$_opt" in
+ raw)
+ _pdev=$(persistent_policy="by-id" kdump_to_udev_name $_val)
+ sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
+ ;;
+ ext[234]|xfs|btrfs|minix)
+ _pdev=$(kdump_to_udev_name $_val)
+ sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
if is_atomic; then
- adjust_bind_mount_path "$config_val"
+ adjust_bind_mount_path "$_val"
fi
;;
ssh|nfs)
- kdump_install_net "$config_val"
+ kdump_install_net "$_val"
;;
dracut_args)
- if [[ $(get_dracut_args_fstype "$config_val") = nfs* ]] ; then
- kdump_install_net "$(get_dracut_args_target "$config_val")"
+ if [[ $(get_dracut_args_fstype "$_val") = nfs* ]] ; then
+ kdump_install_net "$(get_dracut_args_target "$_val")"
fi
;;
kdump_pre|kdump_post|extra_bins)
- dracut_install $config_val
+ dracut_install $_val
;;
core_collector)
- dracut_install "${config_val%%[[:blank:]]*}"
+ dracut_install "${_val%%[[:blank:]]*}"
;;
esac
done < /etc/kdump.conf
6 years, 10 months
[PATCH] makedumpfile: speed up executing using --num-threads options
by Pratyush Anand
makedumpfile 1.6.0+ has --num-threads options, where more than one threads
can dump the vmcore in parallel. However, number of threads should not be
more than usable cpus, otherwise we may have performance degradation.
This patch adds --num-threads options by default if core_collector is
selected as makedumpfile. It adds number of threads same as the number of
online cpus. However, if kdump.conf will have --num-threads specified
already then it will not be modified.
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
kdump-lib-initramfs.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 4c0e2e2837fd..e1fdb466f741 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -21,7 +21,7 @@ NEWROOT="/sysroot"
get_kdump_confs()
{
- local config_opt config_val
+ local config_opt config_val numcpu
while read config_opt config_val;
do
@@ -73,6 +73,12 @@ get_kdump_confs()
esac
done < $KDUMP_CONF
+ if [[ "$CORE_COLLECTOR" =~ "makedumpfile" ]]; then
+ if ! [[ $CORE_COLLECTOR =~ "--num-threads" ]]; then
+ numcpu=$(grep -c '^processor' /proc/cpuinfo)
+ CORE_COLLECTOR="$CORE_COLLECTOR --num-threads $numcpu"
+ fi
+ fi
if [ -z "$CORE_COLLECTOR" ]; then
CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
if is_ssh_dump_target || is_raw_dump_target; then
--
2.7.4
6 years, 10 months
[PATCH V4] drop dracut duplicate functions
by Dave Young
From: Dave Young <dyoung(a)redhat.com>
We maintained several kdump specific functions which are duplicate with the
similar versions in dracut, Dracut upstream splitted dracut init stuff from
dracut-functions.sh so that we can source it now.
Notes about kdump_get_presistent_dev:
Dracut now has a persistent_policy feature, for kdump when we dump to
raw disks we do not care the filesystem uuid and labels so we prefer to
search disk id instead. For raw disk set the persistent_policy before calling
get_persistent_dev ensure kdump logic still work.
Tested filesystem and raw dump in kvm guests.
[Xunlei: drop other functions other than get_persistent_dev.]
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdump-lib.sh | 26 ---------------------
kdumpctl | 8 +++++-
mkdumprd | 70 +++++------------------------------------------------------
3 files changed, 13 insertions(+), 91 deletions(-)
--- kexec-tools.orig/kdump-lib.sh
+++ kexec-tools/kdump-lib.sh
@@ -88,32 +88,6 @@ to_dev_name() {
echo $dev
}
-kdump_get_persistent_dev() {
- local i _tmp _dev _lookup_dirs
-
- _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
- [ -z "$_dev" ] && {
- perror_exit "Kernel dev name of $1 is not found."
- }
-
- if [[ $2 = "raw" ]];then
- _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*"
- else
- _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*"
- fi
-
- for i in $_lookup_dirs; do
- _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
- if [ "$_tmp" = "$_dev" ]; then
- echo $i
- return
- fi
- done
-
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
-}
-
get_user_configured_dump_disk()
{
local _target
--- kexec-tools.orig/kdumpctl
+++ kexec-tools/kdumpctl
@@ -19,6 +19,8 @@ FADUMP_REGISTER_SYS_NODE="/sys/kernel/fa
DEFAULT_DUMP_MODE="kdump"
image_time=0
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
standard_kexec_args="-p"
@@ -432,7 +434,11 @@ check_dump_fs_modified()
if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
_new_dev=$_target
else
- _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
+ _new_dev=$(get_persistent_dev $_target)
+ if [ -z "$_new_dev" ]; then
+ echo "Get persistent device name failed"
+ return 2
+ fi
fi
if ! findmnt $_target >/dev/null; then
--- kexec-tools.orig/mkdumprd
+++ kexec-tools/mkdumprd
@@ -6,6 +6,8 @@
# Written by Cong Wang <amwang(a)redhat.com>
#
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
export IN_KDUMP=1
@@ -78,9 +80,6 @@ add_dracut_sshkey() {
add_dracut_arg "--sshkey" "$1"
}
-# Generic substring function. If $2 is in $1, return 0.
-strstr() { [[ $1 =~ $2 ]]; }
-
target_is_root() {
local _t
_t=$(findmnt -k -n -r -o TARGET $1|sort|head -1)
@@ -127,8 +126,8 @@ to_mount() {
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
- _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
- if [ $? -ne 0 ]; then
+ _pdev="$(get_persistent_dev $_source)"
+ if [ -z "$_pdev" ]; then
return 1
fi
@@ -257,63 +256,6 @@ add_mount() {
fi
}
-# get_maj_min <device>
-# Prints the major and minor of a device node.
-# Example:
-# $ get_maj_min /dev/sda2
-# 8:2
-get_maj_min() {
- local _dev
- _dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null)
- _dev=$(eval "echo $_dev")
- echo $_dev
-}
-
-# ugly workaround for the lvm design
-# There is no volume group device,
-# so, there are no slave devices for volume groups.
-# Logical volumes only have the slave devices they really live on,
-# but you cannot create the logical volume without the volume group.
-# And the volume group might be bigger than the devices the LV needs.
-check_vol_slaves() {
- local _lv _vg _pv
- for i in /dev/mapper/*; do
- _lv=$(get_maj_min $i)
- if [[ $_lv = $2 ]]; then
- _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
- # strip space
- _vg=$(echo $_vg)
- if [[ $_vg ]]; then
- for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
- do
- check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
- done
- fi
- fi
- done
- return 1
-}
-
-# Walk all the slave relationships for a given block device.
-# Stop when our helper function returns success
-# $1 = function to call on every found block device
-# $2 = block device in major:minor format
-check_block_and_slaves() {
- local _x
- [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
- "$1" $2 && return
- check_vol_slaves "$@" && return 0
- if [[ -f /sys/dev/block/$2/../dev ]]; then
- check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
- fi
- [[ -d /sys/dev/block/$2/slaves ]] || return 1
- for _x in /sys/dev/block/$2/slaves/*/dev; do
- [[ -f $_x ]] || continue
- check_block_and_slaves $1 $(cat "$_x") && return 0
- done
- return 1
-}
-
get_block_dump_target()
{
local _target
@@ -532,8 +474,8 @@ do
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
perror_exit "Bad raw disk $config_val"
}
- _praw=$(kdump_get_persistent_dev $config_val "raw")
- if [ $? -ne 0 ]; then
+ _praw=$(persistent_policy="by-id" get_persistent_dev $config_val)
+ if [ -z "$_praw" ]; then
exit 1
fi
add_dracut_arg "--device" "$_praw"
6 years, 10 months
[PATCH 0/2] Small updates on documents
by Tong Li
*** BLURB HERE ***
Tong Li (2):
Correct two typos in kdumpctl and kdump.conf
Debug kernel dump explanation
kdump.conf | 2 +-
kdumpctl | 2 +-
kexec-kdump-howto.txt | 4 ++++
3 files changed, 6 insertions(+), 2 deletions(-)
--
2.7.4
6 years, 10 months
[PATCH] Correct two typos in kdumpctl and kdump.conf
by Tong Li
Fix bug #1367980
Signed-off-by: Tong Li <tonli(a)redhat.com>
---
kdump.conf | 2 +-
kdumpctl | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kdump.conf b/kdump.conf
index 2865414..ebf9587 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -111,7 +111,7 @@
# The default option is "reboot".
#
# force_rebuild <0 | 1>
-# - By default, kdump initrd will only be rebuilt whennecessary.
+# - By default, kdump initrd will only be rebuilt when necessary.
# Specify 1 to force rebuilding kdump initrd every time when kdump
# service starts.
#
diff --git a/kdumpctl b/kdumpctl
index 1cd57e6..6f5df33 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -607,7 +607,7 @@ need_64bit_headers()
print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'`
}
-# Load the kdump kerel specified in /etc/sysconfig/kdump
+# Load the kdump kernel specified in /etc/sysconfig/kdump
# If none is specified, try to load a kdump kernel with the same version
# as the currently running kernel.
load_kdump()
--
2.7.4
6 years, 10 months
[PATCH V2] Drop kdump specific get persistent dev function
by Dave Young
We maintained kdump specific get persistent dev function, it is ready to drop it.
Dracut upstream splitted dracut init stuff from dracut-functions.sh so that we
can source it.
OTOH, dracut now has a persistent_policy feature, for kdump when we dump to
raw disks we do not care the filesystem uuid and labels so we prefer to search
disk id instead. Set the persistent_policy before calling get_persistent_dev will
ensure kdump logic still works.
Tested filesystem and raw dump in kvm guests.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdump-lib.sh | 26 --------------------------
kdumpctl | 8 +++++++-
mkdumprd | 10 ++++++----
3 files changed, 13 insertions(+), 31 deletions(-)
--- kexec-tools.orig/kdump-lib.sh
+++ kexec-tools/kdump-lib.sh
@@ -88,32 +88,6 @@ to_dev_name() {
echo $dev
}
-kdump_get_persistent_dev() {
- local i _tmp _dev _lookup_dirs
-
- _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
- [ -z "$_dev" ] && {
- perror_exit "Kernel dev name of $1 is not found."
- }
-
- if [[ $2 = "raw" ]];then
- _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*"
- else
- _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*"
- fi
-
- for i in $_lookup_dirs; do
- _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
- if [ "$_tmp" = "$_dev" ]; then
- echo $i
- return
- fi
- done
-
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
-}
-
get_user_configured_dump_disk()
{
local _target
--- kexec-tools.orig/kdumpctl
+++ kexec-tools/kdumpctl
@@ -16,6 +16,8 @@ FADUMP_REGISTER_SYS_NODE="/sys/kernel/fa
DEFAULT_DUMP_MODE="kdump"
image_time=0
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
standard_kexec_args="-p"
@@ -416,7 +418,11 @@ check_dump_fs_modified()
if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
_new_dev=$_target
else
- _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
+ _new_dev=$(get_persistent_dev $_target)
+ if [ -z "$_new_dev" ]; then
+ echo "Get persistent device name failed"
+ return 2
+ fi
fi
if ! findmnt $_target >/dev/null; then
--- kexec-tools.orig/mkdumprd
+++ kexec-tools/mkdumprd
@@ -6,6 +6,8 @@
# Written by Cong Wang <amwang(a)redhat.com>
#
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
export IN_KDUMP=1
@@ -127,8 +129,8 @@ to_mount() {
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
- _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
- if [ $? -ne 0 ]; then
+ _pdev="$(get_persistent_dev $_source)"
+ if [ -z "$_pdev" ]; then
return 1
fi
@@ -532,8 +534,8 @@ do
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
perror_exit "Bad raw disk $config_val"
}
- _praw=$(kdump_get_persistent_dev $config_val "raw")
- if [ $? -ne 0 ]; then
+ _praw=$(persistent_policy="by-id" get_persistent_dev $config_val)
+ if [ -z "$_praw" ]; then
exit 1
fi
add_dracut_arg "--device" "$_praw"
6 years, 10 months
[PATCH v3] use dracut version get_persistent_dev and get_maj_min
by Dave Young
We maintained kdump specific get persistent dev function, it is ready to
drop it. Dracut upstream splitted dracut init stuff from dracut-functions.sh
so that we can source it.
OTOH, dracut now has a persistent_policy feature, for kdump when we dump to
raw disks we do not care the filesystem uuid and labels so we prefer to
search disk id instead. For raw disk set the persistent_policy before calling
get_persistent_dev ensure kdump logic still work.
Tested filesystem and raw dump in kvm guests.
[Xunlei: Also drop get_maj_min, dracut-functions.sh also has such a function.]
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdump-lib.sh | 26 --------------------------
kdumpctl | 8 +++++++-
mkdumprd | 22 ++++++----------------
3 files changed, 13 insertions(+), 43 deletions(-)
--- kexec-tools.orig/kdump-lib.sh
+++ kexec-tools/kdump-lib.sh
@@ -88,32 +88,6 @@ to_dev_name() {
echo $dev
}
-kdump_get_persistent_dev() {
- local i _tmp _dev _lookup_dirs
-
- _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
- [ -z "$_dev" ] && {
- perror_exit "Kernel dev name of $1 is not found."
- }
-
- if [[ $2 = "raw" ]];then
- _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*"
- else
- _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*"
- fi
-
- for i in $_lookup_dirs; do
- _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
- if [ "$_tmp" = "$_dev" ]; then
- echo $i
- return
- fi
- done
-
- perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name"
- echo $1
-}
-
get_user_configured_dump_disk()
{
local _target
--- kexec-tools.orig/kdumpctl
+++ kexec-tools/kdumpctl
@@ -19,6 +19,8 @@ FADUMP_REGISTER_SYS_NODE="/sys/kernel/fa
DEFAULT_DUMP_MODE="kdump"
image_time=0
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
standard_kexec_args="-p"
@@ -432,7 +434,11 @@ check_dump_fs_modified()
if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
_new_dev=$_target
else
- _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
+ _new_dev=$(get_persistent_dev $_target)
+ if [ -z "$_new_dev" ]; then
+ echo "Get persistent device name failed"
+ return 2
+ fi
fi
if ! findmnt $_target >/dev/null; then
--- kexec-tools.orig/mkdumprd
+++ kexec-tools/mkdumprd
@@ -6,6 +6,8 @@
# Written by Cong Wang <amwang(a)redhat.com>
#
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
export IN_KDUMP=1
@@ -127,8 +129,8 @@ to_mount() {
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
- _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
- if [ $? -ne 0 ]; then
+ _pdev="$(get_persistent_dev $_source)"
+ if [ -z "$_pdev" ]; then
return 1
fi
@@ -257,18 +259,6 @@ add_mount() {
fi
}
-# get_maj_min <device>
-# Prints the major and minor of a device node.
-# Example:
-# $ get_maj_min /dev/sda2
-# 8:2
-get_maj_min() {
- local _dev
- _dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null)
- _dev=$(eval "echo $_dev")
- echo $_dev
-}
-
# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
@@ -532,8 +522,8 @@ do
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
perror_exit "Bad raw disk $config_val"
}
- _praw=$(kdump_get_persistent_dev $config_val "raw")
- if [ $? -ne 0 ]; then
+ _praw=$(persistent_policy="by-id" get_persistent_dev $config_val)
+ if [ -z "$_praw" ]; then
exit 1
fi
add_dracut_arg "--device" "$_praw"
6 years, 10 months
[PATCH v4 1/2] kdump/fadump: fix network interface name when
switching from fadump to kdump
by Hari Bathini
When a remote dump target is specified, kdump dracut module prefixes
'kdump-' to network interface name (ifname) as kernel assigned names
are not persistent. In fadump mode, kdump dracut module is added to
the default initrd, which adds the 'kdump-' prefix to the ifname of
the prodcution kernel itself. If fadump mode is disabled after this,
kdump dracut module picks the ifname that is already prefixed with
'kdump-' in the production kernel and adds another 'kdump-' to it,
making the ifname something like kdump-kdump-eth0 for kdump kernel.
Eventually, kdump kernel fails with below traces:
dracut-initqueue[246]: RTNETLINK answers: Network is unreachable
dracut-initqueue[246]: arping: Device kdump-kdump-eth0 not available.
The ip command shows the below:
kdump:/# ip addr show kdump-kdump-eth0
2: kdump-kdump-eth: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 \
qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 22:82:87:7b:98:02 brd ff:ff:ff:ff:ff:ff
inet6 2002:903:15f:550:2082:87ff:fe7b:9802/64 scope global \
mngtmpaddr dynamic
valid_lft 2591890sec preferred_lft 604690sec
inet6 fe80::2082:87ff:fe7b:9802/64 scope link
valid_lft forever preferred_lft forever
kdump:/#
The trailing 0 from kdump-kdump-eth0 is missing in the ifname, probably
truncated owing to ifname length limit, while setting.
This patch fixes this by avoiding addition of the prefix 'kdump-' when
such prefix is already present in the ifname.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
* No changes from v3.
dracut-module-setup.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 68e0ff8..0baffaa 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -161,7 +161,11 @@ kdump_get_perm_addr() {
kdump_setup_ifname() {
local _ifname
- if [[ $1 =~ eth* ]]; then
+ # If ifname already has 'kdump-' prefix, we must be switching from
+ # fadump to kdump. Skip prefixing 'kdump-' in this case as adding
+ # another prefix may truncate the ifname. Since an ifname with
+ # 'kdump-' is already persistent, this should be fine.
+ if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
_ifname="kdump-$1"
else
_ifname="$1"
6 years, 10 months