Skip num-threads when -E and -F option is present

Resolves: https://issues.redhat.com/browse/RHEL-75537
Upstream: kdump-utils
Conflict: None

Back porting a series patches in kdump-utils to Fix the --num-threads
and -E option issules
  9a51c4b kdump.sh: Skip num-threads when -E and -F option is present
  23bbb11 kdump.sh: Centralize the num-threads sub-option handling
  837f1c9 kdump.sh: Centralize the -F suboption handling

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2025-12-16 10:35:42 +08:00
parent 4663e6f293
commit 1ff2f4ddb7
4 changed files with 174 additions and 1 deletions

View File

@ -0,0 +1,61 @@
From 837f1c9a8bd7fd898eb848bd473a32d8eee30307 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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 7c4c71c..0fd94c0 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"
--
2.49.0

View File

@ -0,0 +1,61 @@
From 23bbb1156fe6fc03a3744ce538d908ad9cb0b694 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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 0fd94c0..656911f 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
--
2.49.0

View File

@ -0,0 +1,49 @@
From 9a51c4b4742b7bf778e2dc32cff24d94bb2a5cd1 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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 656911f..5155453 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
--
2.49.0

View File

@ -16,7 +16,9 @@ Patch05: 0005-Allow-sudo-kdumpctl-for-LUKS-dump-target.patch
Patch06: 0006-Revert-Strip-surrounding-quotes-from-configuration-v.patch
Patch07: 0007-kdump-lib-initramfs-rewrite-kdump_get_conf_val.patch
Patch08: 0008-Add-persisent-device-if-FIPS-is-enabled.patch
Patch09: 0009-kdump.sh-Centralize-the-F-suboption-handling.patch
Patch10: 0010-kdump.sh-Centralize-the-num-threads-sub-option-handl.patch
Patch11: 0011-kdump.sh-Skip-num-threads-when-E-and-F-option-is-pre.patch
%ifarch ppc64 ppc64le
Requires(post): servicelog