From 1ae9a84d28880d82f82257f8b5d63c7fbda1d7c6 Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Fri, 28 Nov 2025 09:49:35 +0800 Subject: [PATCH 1/3] kdump.sh: Centralize the -F suboption handling Signed-off-by: Pingfan Liu --- dracut/99kdumpbase/kdump.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/dracut/99kdumpbase/kdump.sh b/dracut/99kdumpbase/kdump.sh index 7c4c71ce..0fd94c03 100755 --- a/dracut/99kdumpbase/kdump.sh +++ b/dracut/99kdumpbase/kdump.sh @@ -22,8 +22,7 @@ KDUMP_LOG_DEST="" KDUMP_LOG_OP="" KDUMP_TEST_ID="" KDUMP_TEST_STATUS="" -CORE_COLLECTOR="" -DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31" +CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31" DMESG_COLLECTOR="/sbin/vmcore-dmesg" FAILURE_ACTION="systemctl reboot -f" DATEDIR=$(date +%Y-%m-%d-%T) @@ -108,12 +107,16 @@ get_kdump_confs() { esac done < "$KDUMP_CONF_PARSED" - if [ -z "$CORE_COLLECTOR" ]; then - CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR" - if is_ssh_dump_target || is_raw_dump_target; then - CORE_COLLECTOR="$CORE_COLLECTOR -F" - fi - fi + case $CORE_COLLECTOR in + *makedumpfile*) + # Ensure no -F in makedumpfile by default. + CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g") + if is_ssh_dump_target || is_raw_dump_target; then + CORE_COLLECTOR="$CORE_COLLECTOR -F" + fi + ;; + esac + } # store the kexec kernel log to a file. @@ -145,10 +148,8 @@ dump_fs() { fi fi - # Remove -F in makedumpfile case. We don't want a flat format dump here. case $CORE_COLLECTOR in *makedumpfile*) - CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g") THREADS=$(nproc) if [ "$THREADS" -gt 1 ]; then CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" From 503f4dc083546db67c11b0ebba052ba7f3593fb1 Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Thu, 27 Nov 2025 15:24:18 +0800 Subject: [PATCH 2/3] kdump.sh: Centralize the num-threads sub-option handling The handling of num-threads is duplicated in dump_fs() and dump_raw(). Centralize them into get_kdump_confs() Signed-off-by: Pingfan Liu --- dracut/99kdumpbase/kdump.sh | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dracut/99kdumpbase/kdump.sh b/dracut/99kdumpbase/kdump.sh index 0fd94c03..656911f2 100755 --- a/dracut/99kdumpbase/kdump.sh +++ b/dracut/99kdumpbase/kdump.sh @@ -114,6 +114,10 @@ get_kdump_confs() { if is_ssh_dump_target || is_raw_dump_target; then CORE_COLLECTOR="$CORE_COLLECTOR -F" fi + THREADS=$(nproc) + if [ "$THREADS" -gt 1 ]; then + CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" + fi ;; esac @@ -148,15 +152,6 @@ dump_fs() { fi fi - case $CORE_COLLECTOR in - *makedumpfile*) - THREADS=$(nproc) - if [ "$THREADS" -gt 1 ]; then - CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" - fi - ;; - esac - if [ -z "$KDUMP_TEST_ID" ]; then _dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /) else @@ -385,13 +380,6 @@ dump_raw() { /kdumpscripts/monitor_dd_progress.sh $_src_size_mb & fi - if echo "$CORE_COLLECTOR" | grep -q makedumpfile; then - THREADS=$(nproc) - if [ "$THREADS" -gt 1 ]; then - CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" - fi - fi - dinfo "saving vmcore" $CORE_COLLECTOR /proc/vmcore | dd of="$1" bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1 sync From 0c9c6aba111be6a88605bfceb9bbf59760c83f39 Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Fri, 28 Nov 2025 13:51:21 +0800 Subject: [PATCH 3/3] kdump.sh: Skip num-threads when -E and -F option is present Resolves: https://issues.redhat.com/browse/RHEL-75537 Configure "makedumpfile -E -d 31" in kdump.conf, and panic the system, kdump will fail with the error as: [ 41.891856] kdump.sh[724]: --num-threads cannot used with ELF format. [ 41.897104] kdump.sh[724]: Commandline parameter is invalid. [ 41.897290] kdump.sh[724]: Try `makedumpfile --help' for more information. [ 41.897435] kdump.sh[724]: makedumpfile Failed. [ 41.898804] kdump[726]: saving vmcore failed, exitcode:1 Skip --num-threads when -E option is given. As for the -F option, it is meaningless to sequentially access linear addresses with multiple threads Skip --num-threads too in that case. Signed-off-by: Pingfan Liu --- dracut/99kdumpbase/kdump.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dracut/99kdumpbase/kdump.sh b/dracut/99kdumpbase/kdump.sh index 656911f2..5155453c 100755 --- a/dracut/99kdumpbase/kdump.sh +++ b/dracut/99kdumpbase/kdump.sh @@ -116,7 +116,13 @@ get_kdump_confs() { fi THREADS=$(nproc) if [ "$THREADS" -gt 1 ]; then - CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" + case "$CORE_COLLECTOR" in + *-F* | *-E*) ;; + + *) + CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS" + ;; + esac fi ;; esac