diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh index 21a357d..f492096 100755 --- a/SOURCES/dracut-module-setup.sh +++ b/SOURCES/dracut-module-setup.sh @@ -30,7 +30,7 @@ depends() { done } - if is_squash_available; then + if is_squash_available && ! is_fadump_capable; then _dep="$_dep squash" else dwarning "Required modules to build a squashed kdump image is missing!" diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh index 817ba01..c7f9522 100755 --- a/SOURCES/kdump-lib-initramfs.sh +++ b/SOURCES/kdump-lib-initramfs.sh @@ -56,13 +56,13 @@ get_kdump_confs() FAILURE_ACTION="kdump_emergency_shell" ;; reboot) - FAILURE_ACTION="systemctl reboot -f" + FAILURE_ACTION="systemctl reboot -f && exit" ;; halt) - FAILURE_ACTION="halt" + FAILURE_ACTION="halt && exit" ;; poweroff) - FAILURE_ACTION="systemctl poweroff -f" + FAILURE_ACTION="systemctl poweroff -f && exit" ;; dump_to_rootfs) FAILURE_ACTION="dump_to_rootfs" @@ -96,15 +96,31 @@ get_kdump_confs() # dump_fs dump_fs() { - + local _do_umount="" local _dev=$(findmnt -k -f -n -r -o SOURCE $1) local _mp=$(findmnt -k -f -n -r -o TARGET $1) - - echo "kdump: dump target is $_dev" + local _op=$(findmnt -k -f -n -r -o OPTIONS $1) if [ -z "$_mp" ]; then - echo "kdump: error: Dump target $_dev is not mounted." - return 1 + _dev=$(findmnt -s -f -n -r -o SOURCE $1) + _mp=$(findmnt -s -f -n -r -o TARGET $1) + _op=$(findmnt -s -f -n -r -o OPTIONS $1) + + if [ -n "$_dev" ] && [ -n "$_mp" ]; then + echo "kdump: dump target $_dev is not mounted, trying to mount..." + mkdir -p $_mp + mount -o $_op $_dev $_mp + + if [ $? -ne 0 ]; then + echo "kdump: mounting failed (mount point: $_mp, option: $_op)" + return 1 + fi + _do_umount=1 + else + echo "kdump: error: Dump target $_dev is not usable" + fi + else + echo "kdump: dump target is $_dev" fi # Remove -F in makedumpfile case. We don't want a flat format dump here. @@ -123,6 +139,11 @@ dump_fs() sync echo "kdump: saving vmcore complete" + + if [ $_do_umount ]; then + umount $_mp || echo "kdump: warn: failed to umount target" + fi + # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure return 0 } diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index e8529d6..3ea683c 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -108,9 +108,10 @@ to_mount() { fi #mount fs target as rw in 2nd kernel _options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g') - # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd - # kernel, filter it out here. + # filter out 'noauto' here, it will be force appended later, avoid duplication _options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g') + # only mount the dump target when needed. + _options="$_options,noauto" _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index 95abb83..1b597c3 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.19 -Release: 12%{?dist} +Release: 12%{?dist}.1 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -151,7 +151,7 @@ cp %{SOURCE27} . cp %{SOURCE28} . make -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic make -C makedumpfile-1.6.5 LINKTYPE=dynamic USELZO=on USESNAPPY=on make -C makedumpfile-1.6.5 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so @@ -204,7 +204,7 @@ install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5 install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 install -m 755 makedumpfile-1.6.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile install -m 644 makedumpfile-1.6.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz install -m 644 makedumpfile-1.6.5/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz @@ -317,7 +317,7 @@ done %{_bindir}/* %{_datadir}/kdump %{_prefix}/lib/kdump -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_sysconfdir}/makedumpfile.conf.sample %endif %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump @@ -344,12 +344,17 @@ done %doc supported-kdump-targets.txt %doc kdump-in-cluster-environment.txt %doc live-image-kdump-howto.txt -%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{arm} +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 %{_libdir}/eppic_makedumpfile.so /usr/share/makedumpfile/ %endif %changelog +* Thu Nov 14 2019 Pingfan Liu - 2.0.19-12.1 +- Don't execute final_action if failure_action terminates the system +- dracut-module-setup.sh: Don't use squash module for fadump +- Don't mount the dump target unless needed + * Fri Aug 9 2019 Pingfan Liu - 2.0.19-12 - Don't forward and drop journalctl logs for fadump