From 63331730036c85086adb4003b00afaf67cd43685 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Jan 08 2021 13:46:38 +0000 Subject: Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/kexec-tools.git#fc703518525dc85b88873120f2bcf7bffa682735 --- diff --git a/dracut-kdump.sh b/dracut-kdump.sh index c2627c2..370d217 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -105,10 +105,12 @@ dump_raw() dump_ssh() { - local ret + local _ret=0 + local _exitcode=0 _exitcode2=0 local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes" local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" local _host=$2 + local _vmcore="vmcore" dinfo "saving to $_host:$_dir" @@ -122,25 +124,36 @@ dump_ssh() if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete" - ret=$? - save_log - scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/" - if [ $ret -ne 0 ]; then - return 1 - fi - ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore" || return 1 + _exitcode=$? else $CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete" - ret=$? - save_log - scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/" - if [ $ret -ne 0 ]; then - return 1 + _exitcode=$? + _vmcore="vmcore.flat" + fi + + if [ $_exitcode -eq 0 ]; then + ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/$_vmcore" + _exitcode2=$? + if [ $_exitcode2 -ne 0 ]; then + derror "moving vmcore failed, _exitcode:$_exitcode2" + else + dinfo "saving vmcore complete" fi - ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore.flat" || return 1 + else + derror "saving vmcore failed, _exitcode:$_exitcode" + fi + + save_log + scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "saving log file failed, _exitcode:$_ret" + fi + + if [ $_exitcode -ne 0 ] || [ $_exitcode2 -ne 0 ];then + return 1 fi - dinfo "saving vmcore complete" return 0 } diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 791d141..e766f95 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -115,7 +115,7 @@ save_log() # dump_fs dump_fs() { - local ret + local _exitcode local _mp=$1 local _dev=$(get_mount_info SOURCE target $_mp -f) local _op=$(get_mount_info OPTIONS target $_mp -f) @@ -159,16 +159,20 @@ dump_fs() dinfo "saving vmcore" $CORE_COLLECTOR /proc/vmcore $_dump_path/vmcore-incomplete - ret=$? + _exitcode=$? + if [ $_exitcode -eq 0 ]; then + mv $_dump_path/vmcore-incomplete $_dump_path/vmcore + sync + dinfo "saving vmcore complete" + else + derror "saving vmcore failed, _exitcode:$_exitcode" + fi + save_log mv $KDUMP_LOG_FILE $_dump_path/ - if [ $ret -ne 0 ]; then - return 1 + if [ $_exitcode -ne 0 ]; then + return 1 fi - mv $_dump_path/vmcore-incomplete $_dump_path/vmcore - sync - - dinfo "saving vmcore complete" # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure return 0 diff --git a/kdumpctl b/kdumpctl index 3f6a9be..2e7f842 100755 --- a/kdumpctl +++ b/kdumpctl @@ -944,7 +944,7 @@ check_fence_kdump_config() return 1 fi # node can be ipaddr - echo $ipaddrs | grep $node > /dev/null + echo "$ipaddrs " | grep "$node " > /dev/null if [ $? -eq 0 ]; then derror "Option fence_kdump_nodes cannot contain $node" return 1 diff --git a/kexec-tools-2.0.21-makedumpfile-make-use-of-uts_namespace.name-offset-in-VMCOR.patch b/kexec-tools-2.0.21-makedumpfile-make-use-of-uts_namespace.name-offset-in-VMCOR.patch new file mode 100644 index 0000000..0c29723 --- /dev/null +++ b/kexec-tools-2.0.21-makedumpfile-make-use-of-uts_namespace.name-offset-in-VMCOR.patch @@ -0,0 +1,101 @@ +From 54aec3878b3f91341e6bc735eda158cca5c54ec9 Mon Sep 17 00:00:00 2001 +From: Alexander Egorenkov +Date: Fri, 18 Sep 2020 13:55:56 +0200 +Subject: [PATCH] [PATCH] make use of 'uts_namespace.name' offset in VMCOREINFO + +* Required for kernel 5.11 + +The offset of the field 'init_uts_ns.name' has changed since +kernel commit 9a56493f6942 ("uts: Use generic ns_common::count"). +Make use of the offset 'uts_namespace.name' if available in +VMCOREINFO. + +Signed-off-by: Alexander Egorenkov +--- + makedumpfile.c | 17 +++++++++++++++-- + makedumpfile.h | 6 ++++++ + 2 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/makedumpfile.c b/makedumpfile.c +index 061741f..ecd63fa 100644 +--- a/makedumpfile-1.6.8/makedumpfile.c ++++ b/makedumpfile-1.6.8/makedumpfile.c +@@ -1159,7 +1159,10 @@ check_release(void) + if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) { + utsname = SYMBOL(system_utsname); + } else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) { +- utsname = SYMBOL(init_uts_ns) + sizeof(int); ++ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE) ++ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name); ++ else ++ utsname = SYMBOL(init_uts_ns) + sizeof(int); + } else { + ERRMSG("Can't get the symbol of system_utsname.\n"); + return FALSE; +@@ -2040,6 +2043,11 @@ get_structure_info(void) + SIZE_INIT(cpu_spec, "cpu_spec"); + OFFSET_INIT(cpu_spec.mmu_features, "cpu_spec", "mmu_features"); + ++ /* ++ * Get offsets of the uts_namespace's members. ++ */ ++ OFFSET_INIT(uts_namespace.name, "uts_namespace", "name"); ++ + return TRUE; + } + +@@ -2109,7 +2117,10 @@ get_str_osrelease_from_vmlinux(void) + if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) { + utsname = SYMBOL(system_utsname); + } else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) { +- utsname = SYMBOL(init_uts_ns) + sizeof(int); ++ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE) ++ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name); ++ else ++ utsname = SYMBOL(init_uts_ns) + sizeof(int); + } else { + ERRMSG("Can't get the symbol of system_utsname.\n"); + return FALSE; +@@ -2344,6 +2355,7 @@ write_vmcoreinfo_data(void) + WRITE_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list); + WRITE_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift); + WRITE_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features); ++ WRITE_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name); + + if (SYMBOL(node_data) != NOT_FOUND_SYMBOL) + WRITE_ARRAY_LENGTH("node_data", node_data); +@@ -2743,6 +2755,7 @@ read_vmcoreinfo(void) + READ_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list); + READ_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift); + READ_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features); ++ READ_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name); + + READ_STRUCTURE_SIZE("printk_log", printk_log); + READ_STRUCTURE_SIZE("printk_ringbuffer", printk_ringbuffer); +diff --git a/makedumpfile.h b/makedumpfile.h +index 47f7e79..5f50080 100644 +--- a/makedumpfile-1.6.8/makedumpfile.h ++++ b/makedumpfile-1.6.8/makedumpfile.h +@@ -1728,6 +1728,8 @@ struct size_table { + long cpu_spec; + + long pageflags; ++ ++ long uts_namespace; + }; + + struct offset_table { +@@ -1935,6 +1937,10 @@ struct offset_table { + struct cpu_spec_s { + long mmu_features; + } cpu_spec; ++ ++ struct uts_namespace_s { ++ long name; ++ } uts_namespace; + }; + + /* +-- +2.29.2 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 3f94bcb..d7497e0 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -5,7 +5,7 @@ Name: kexec-tools Version: 2.0.21 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Summary: The kexec/kdump userspace component @@ -63,6 +63,7 @@ Requires: dracut >= 050 Requires: dracut-network >= 050 Requires: dracut-squash >= 050 Requires: ethtool +BuildRequires: make BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units @@ -102,6 +103,7 @@ Requires: systemd-udev%{?_isa} Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch Patch603: ./kexec-tools-2.0.20-makedumpfile-printk-add-support-for-lockless-ringbuffer.patch Patch604: ./kexec-tools-2.0.20-makedumpfile-printk-use-committed-finalized-state-value.patch +Patch605: ./kexec-tools-2.0.21-makedumpfile-make-use-of-uts_namespace.name-offset-in-VMCOR.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -120,6 +122,7 @@ tar -z -x -v -f %{SOURCE19} %patch601 -p1 %patch603 -p1 %patch604 -p1 +%patch605 -p1 %ifarch ppc %define archdef ARCH=ppc @@ -358,6 +361,12 @@ done %endif %changelog +* Fri Jan 08 2021 Kairui Song - 2.0.21-2 +- makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO +- kdumpctl: fix a variable expansion in check_fence_kdump_config() +- Add BuildRequires: make +- Save the final failure information to log file if saving vmcore failed + * Wed Dec 23 2020 Kairui Song - 2.0.21-1 - makedumpfile: printk: use committed/finalized state values - makedumpfile: printk: add support for lockless ringbuffer