diff --git a/kdump-activate-QETH-devices.patch b/kdump-activate-QETH-devices.patch new file mode 100644 index 0000000..0fd3dbb --- /dev/null +++ b/kdump-activate-QETH-devices.patch @@ -0,0 +1,124 @@ +From: Petr Tesarik +Date: Thu Jun 29 18:11:52 2017 +0200 +Subject: Activate QETH network devices +References: bsc#1038669 +Upstream: v0.8.17 +Git-commit: 2288f2b56fec0298fdf21ff7a5dd03157d12242e + +Take care of activating QETH devices in the kdump environment, because +dracut does not do it automatically. + +Signed-off-by: Petr Tesarik + +--- + init/setup-kdump.functions | 72 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 72 insertions(+) + +--- a/init/setup-kdump.functions ++++ b/init/setup-kdump.functions +@@ -457,6 +457,7 @@ function kdump_vlan_config() # { + # kdump_netif corresponding ifname= initrd parameter added + # kdump_iface device name in initrd + # kdump_kmods additional kernel modules updated ++# kdump_hwif hardware interfaces updated + function kdump_ifname_config() # {{{ + { + kdump_iface="$1" +@@ -464,6 +465,8 @@ function kdump_ifname_config() # + + if [ -z "$ifkind" ] + then ++ kdump_hwif="$kdump_hwif $kdump_iface" ++ + local hwaddr + local addrtype=$(<"/sys/class/net/$kdump_iface/addr_assign_type") + if [ "$addrtype" -eq 0 ] +@@ -1038,6 +1041,69 @@ function kdump_filter_sysctl() # + } # }}} + + # ++# Set up a QETH network interface ++# Parameters: ++# 1) _root: initrd temporary root ++# 2) _iface: interface name ++# Input variables: ++# kdump_hwif hardware network interfaces ++function kdump_setup_qeth() # {{{ ++{ ++ local _root="$1" ++ local _iface="$2" ++ local _dev=$( readlink "/sys/class/net/$_iface/device" ) ++ _dev="${_dev##*/}" ++ local _cdev0=$( readlink "/sys/class/net/$_iface/device/cdev0" ) ++ _cdev0="${_cdev0##*/}" ++ local _cdev1=$( readlink "/sys/class/net/$_iface/device/cdev1" ) ++ _cdev1="${_cdev1##*/}" ++ local _cdev2=$( readlink "/sys/class/net/$_iface/device/cdev2" ) ++ _cdev2="${_cdev2##*/}" ++ local _layer2=$("${_root}/etc/udev/rules.d/51-qeth-${_dev}.rules" < +Date: Wed Jun 21 15:31:21 2017 +0200 +Subject: Do not request filesystem check on bind mounts +References: bsc#1034169 +Upstream: v0.8.17 +Git-commit: 395a14377816a19678da481cafdf2332e0b0c932 + +When creating fstab for kdump bind mounts the dump and fsck fields are not +specified. These should be 0 because the directory which is bind-mounted cannot +be checked nor dumped. + +Reported-by: Neil Brown +Signed-off-by: Michal Suchanek + +--- kdump-0.8.16/init/module-setup.sh~ 2017-06-01 16:56:11.765609113 +0200 ++++ kdump-0.8.16/init/module-setup.sh 2017-06-01 16:58:31.295723256 +0200 +@@ -168,7 +168,7 @@ + do + line=( ${fstab_lines[i]} ) + if [ "${line[1]%/*}" = "/kdump" ] ; then +- fstab_lines[i]="/sysroot ${line[1]} none bind" ++ fstab_lines[i]="/sysroot ${line[1]} none bind 0 0" + fi + done + fi diff --git a/kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch b/kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch new file mode 100644 index 0000000..6b3bc76 --- /dev/null +++ b/kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch @@ -0,0 +1,31 @@ +From: Michal Suchanek +Date: Wed Jun 21 15:25:49 2017 +0200 +Subject: Do not free fadump memory when reboot is requested +References: bsc#1040610 +Upstream: v0.8.17 +Git-commit: 653f8c0931c638cbb0bd5c22fc0e1dfd7969b29a + +Freeing fadump memory can take a long time and doing it when we are going to +reboot anyway is pointless. + +In bsc#1034169 a kernel oops is triggered by freeing fadump memory killing +save_dump.sh and preventing the reboot requested by the user from happening +entirely. + +Avoid the issue and speed up reboot by not freeing fadump memory when reboot is +requested. + +Signed-off-by: Michal Suchanek + +--- kdump-0.8.16/init/save_dump.sh~ 2017-06-16 13:59:02.017110055 +0200 ++++ kdump-0.8.16/init/save_dump.sh 2017-06-16 13:59:35.629621303 +0200 +@@ -49,7 +49,8 @@ + + if fadump_enabled; then + # release memory if possible +- test -f $FADUMP_RELEASE_MEM && echo 1 > $FADUMP_RELEASE_MEM ++ [ -f $FADUMP_RELEASE_MEM -a $KDUMP_IMMEDIATE_REBOOT != "yes" \ ++ -a "$KDUMP_IMMEDIATE_REBOOT" != "YES" ] && echo 1 > $FADUMP_RELEASE_MEM + if [ "$KDUMP_FADUMP_SHELL" = "yes" \ + -o "$KDUMP_FADUMP_SHELL" = "YES" ] ; then + echo diff --git a/kdump-explicitly-request-zFCP-devices.patch b/kdump-explicitly-request-zFCP-devices.patch new file mode 100644 index 0000000..5c39bfd --- /dev/null +++ b/kdump-explicitly-request-zFCP-devices.patch @@ -0,0 +1,58 @@ +From: Petr Tesarik +Date: Fri Jun 23 14:53:50 2017 +0200 +Subject: Explicitly request zFCP devices in kdump initrd +References: bsc#1008352 +Upstream: v0.8.17 +Git-commit: 81899709e4a12bea4819d4ccc10f960cb535b447 + +When using NPIV with LUN autoscan, dracut does not save the port and +LUN information. However, LUN autoscan is always disabled in kdump +environment, so the LUNs will never appear. + +To fix this case, the full information must be saved explicitly in a +kdump initrd. + +Signed-off-by: Petr Tesarik + +--- + init/module-setup.sh | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/init/module-setup.sh ++++ b/init/module-setup.sh +@@ -81,6 +81,25 @@ kdump_add_mpath_dev() { + fi + } + ++kdump_cmdline_zfcp() { ++ is_zfcp() { ++ local _dev=$1 ++ local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD) ++ local _sdev _lun _wwpn _ccw ++ ++ [ "${_devpath#*/sd}" == "$_devpath" ] && return 1 ++ _sdev="${_devpath%%/block/*}" ++ [ -e ${_sdev}/fcp_lun ] || return 1 ++ _ccw=$(cat ${_sdev}/hba_id) ++ _lun=$(cat ${_sdev}/fcp_lun) ++ _wwpn=$(cat ${_sdev}/wwpn) ++ echo "rd.zfcp=${_ccw},${_wwpn},${_lun}" ++ } ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ for_each_host_dev_and_slaves_all is_zfcp ++ } | sort -u ++} ++ + kdump_cmdline_ip() { + [ "$kdump_neednet" = y ] || return 0 + +@@ -142,6 +161,9 @@ kdump_gen_mount_units() { + } + + cmdline() { ++ local _arch=$(uname -m) ++ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && kdump_cmdline_zfcp ++ + kdump_cmdline_ip + } + diff --git a/kdump-fail-if-fadump-cannot-be-registered.patch b/kdump-fail-if-fadump-cannot-be-registered.patch new file mode 100644 index 0000000..c7514f7 --- /dev/null +++ b/kdump-fail-if-fadump-cannot-be-registered.patch @@ -0,0 +1,40 @@ +From: Petr Tesarik +Date: Mon Jun 26 13:22:10 2017 +0200 +Subject: Fail at startup if fadump cannot be registered +References: bsc#1040567 +Upstream: v0.8.17 +Git-commit: 99a38e490012da75d83efb83385d42edbea100e9 + +If writing "1" into /sys/kernel/fadump_registered fails for whatever +reason, do not return success. + +Signed-off-by: Petr Tesarik + +diff --git a/init/load.sh b/init/load.sh +index 1894551..4fc7a82 100755 +--- a/init/load.sh ++++ b/init/load.sh +@@ -241,17 +241,19 @@ function load_kdump_fadump() + fi + + local msg ++ local result=0 + + # The kernel fails with EINVAL if registered already + # (see bnc#814780) +- if [ $(cat "$FADUMP_REGISTERED") != "1" ] ; then +- local output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1) +- local result=$? ++ if [ "$(cat $FADUMP_REGISTERED)" != "1" ] ; then ++ local output + +- if [ $result -eq 0 ] ; then ++ output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1) ++ if [ $? -eq 0 ] ; then + msg="Registered fadump" + else + msg="FAILED to register fadump: $output" ++ result=1 + fi + else + msg="fadump is already registered" diff --git a/kdump-fix-save_dump-to-NFS.patch b/kdump-fix-save_dump-to-NFS.patch new file mode 100644 index 0000000..bc9caec --- /dev/null +++ b/kdump-fix-save_dump-to-NFS.patch @@ -0,0 +1,80 @@ +From: Petr Tesarik +Date: Thu Jun 22 14:23:02 2017 +0200 +Subject: Fix save_dump to NFS targets +References: bsc#1045541 +Upstream: v0.8.17 +Git-commit: 11d36a645ab99c9805f9fa3ca9eabce3aa2a9418 + +For NFS, the parent directory of the target must be mounted, because +the target directory itself does not exist yet. + +For this to work, split the target path to directory (i.e. parent +directory) and basename. Then construct a unique mount point from the +host name and the parent directory, and finally append the base name +again to form a subdirectory in the target (to be created by the file +transfer method). + +Signed-off-by: Petr Tesarik + +--- + kdumptool/transfer.cc | 24 +++++++++++------------- + kdumptool/transfer.h | 4 +--- + 2 files changed, 12 insertions(+), 16 deletions(-) + +--- a/kdumptool/transfer.cc ++++ b/kdumptool/transfer.cc +@@ -462,22 +462,20 @@ RootDirURL NFSTransfer::translate(const + if (!rt.check(config->KDUMP_NET_TIMEOUT.value())) + cerr << "WARNING: Dump target not reachable" << endl; + +- string mountedDir = parser.getPath(); +- FileUtil::nfsmount(parser.getHostname(), mountedDir, +- DEFAULT_MOUNTPOINT, options); +- ++ FilePath path = parser.getPath(); ++ string mountedDir = path.dirName(); ++ string rest = path.baseName(); + + m_mountpoint = DEFAULT_MOUNTPOINT; +- m_rest = parser.getPath(); +- m_rest.replace(m_rest.begin(), m_rest.begin() + mountedDir.size(), ""); +- m_rest.ltrim("/"); ++ m_mountpoint.appendPath(parser.getHostname()).appendPath(mountedDir); ++ m_mountpoint.mkdir(true); ++ Debug::debug()->dbg("Path: %s, Mountpoint: %s, Rest: %s", ++ path.c_str(), m_mountpoint.c_str(), rest.c_str()); + +- (m_prefix = m_mountpoint).appendPath(m_rest); +- +- Debug::debug()->dbg("Mountpoint: %s, Rest: %s, Prefix: $s", +- m_mountpoint.c_str(), m_rest.c_str(), m_prefix.c_str()); ++ FileUtil::nfsmount(parser.getHostname(), mountedDir, ++ m_mountpoint, options); + +- return RootDirURL("file://" + m_prefix, ""); ++ return RootDirURL("file://" + m_mountpoint + PATH_SEPARATOR + rest, ""); + } + + // ----------------------------------------------------------------------------- +@@ -507,7 +505,7 @@ void NFSTransfer::close() + throw (KError) + { + Debug::debug()->trace("NFSTransfer::close()"); +- if (m_mountpoint.size() > 0) { ++ if (!m_mountpoint.empty()) { + FileUtil::umount(m_mountpoint); + m_mountpoint.clear(); + } +--- a/kdumptool/transfer.h ++++ b/kdumptool/transfer.h +@@ -271,9 +271,7 @@ class NFSTransfer : public URLTransfer { + + + private: +- std::string m_mountpoint; +- KString m_rest; +- FilePath m_prefix; ++ FilePath m_mountpoint; + FileTransfer *m_fileTransfer; + }; + diff --git a/kdump-invoke-subcommand-destructors-on-exit.patch b/kdump-invoke-subcommand-destructors-on-exit.patch new file mode 100644 index 0000000..4fe2cf1 --- /dev/null +++ b/kdump-invoke-subcommand-destructors-on-exit.patch @@ -0,0 +1,27 @@ +From: Petr Tesarik +Date: Thu Jun 22 14:31:26 2017 +0200 +Subject: Invoke subcommand destructors on exit +References: bsc#1045541 +Upstream: v0.8.17 +Git-commit: ff813cdc274caf7c006d438dbf30d83413bb896e + +To execute the destructor for a subcommand, the object must be +explicitly freed in KdumpTool destructor. This fixes a bug that +NFS shares are not unmounted on exit. + +Signed-off-by: Petr Tesarik + +--- + kdumptool/kdumptool.cc | 1 + + 1 file changed, 1 insertion(+) + +--- a/kdumptool/kdumptool.cc ++++ b/kdumptool/kdumptool.cc +@@ -67,6 +67,7 @@ KdumpTool::~KdumpTool() + throw () + { + Debug::debug()->trace("KdumpTool::~KdumpTool()"); ++ delete m_subcommand; + } + + // ----------------------------------------------------------------------------- diff --git a/kdump-move-class-SystemCPU-to-header-file.patch b/kdump-move-class-SystemCPU-to-header-file.patch new file mode 100644 index 0000000..8f3309f --- /dev/null +++ b/kdump-move-class-SystemCPU-to-header-file.patch @@ -0,0 +1,139 @@ +From: Petr Tesarik +Date: Fri Jun 23 13:19:41 2017 +0200 +Subject: Move class SystemCPU to a header file +References: bsc#1036223 +Upstream: v0.8.17 +Git-commit: ded0d2117cce72fc98a7ca9ee577090889ef9b16 + +This allows to reuse the class outside of calibrate.cc. + +Signed-off-by: Petr Tesarik + +--- + kdumptool/calibrate.cc | 47 --------------------------------------------- + kdumptool/calibrate.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 51 insertions(+), 47 deletions(-) + +--- a/kdumptool/calibrate.cc ++++ b/kdumptool/calibrate.cc +@@ -251,53 +251,6 @@ using std::ifstream; + + //{{{ SystemCPU ---------------------------------------------------------------- + +-class SystemCPU { +- +- public: +- /** +- * Initialize a new SystemCPU object. +- * +- * @param[in] sysdir Mount point for sysfs +- */ +- SystemCPU(const char *sysdir = "/sys") +- throw () +- : m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu")) +- {} +- +- protected: +- /** +- * Path to the cpu system devices base directory +- */ +- const FilePath m_cpudir; +- +- /** +- * Count the number of CPUs in a cpuset +- * +- * @param[in] name Name of the cpuset ("possible", "present", "online") +- * +- * @exception KError if the file cannot be opened or parsed +- */ +- unsigned long count(const char *name); +- +- public: +- /** +- * Count the number of online CPUs +- * +- * @exception KError see @c count() +- */ +- unsigned long numOnline(void) +- { return count("online"); } +- +- /** +- * Count the number of offline CPUs +- * +- * @exception KError see @c count() +- */ +- unsigned long numOffline(void) +- { return count("offline"); } +- +-}; +- + // ----------------------------------------------------------------------------- + unsigned long SystemCPU::count(const char *name) + { +--- a/kdumptool/calibrate.h ++++ b/kdumptool/calibrate.h +@@ -20,6 +20,7 @@ + #define CALIBRATE_H + + #include "subcommand.h" ++#include "fileutil.h" + + //{{{ Calibrate ---------------------------------------------------------------- + +@@ -54,6 +55,56 @@ class Calibrate : public Subcommand { + }; + + //}}} ++//{{{ SystemCPU ---------------------------------------------------------------- ++ ++class SystemCPU { ++ ++ public: ++ /** ++ * Initialize a new SystemCPU object. ++ * ++ * @param[in] sysdir Mount point for sysfs ++ */ ++ SystemCPU(const char *sysdir = "/sys") ++ throw () ++ : m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu")) ++ {} ++ ++ protected: ++ /** ++ * Path to the cpu system devices base directory ++ */ ++ const FilePath m_cpudir; ++ ++ /** ++ * Count the number of CPUs in a cpuset ++ * ++ * @param[in] name Name of the cpuset ("possible", "present", "online") ++ * ++ * @exception KError if the file cannot be opened or parsed ++ */ ++ unsigned long count(const char *name); ++ ++ public: ++ /** ++ * Count the number of online CPUs ++ * ++ * @exception KError see @c count() ++ */ ++ unsigned long numOnline(void) ++ { return count("online"); } ++ ++ /** ++ * Count the number of offline CPUs ++ * ++ * @exception KError see @c count() ++ */ ++ unsigned long numOffline(void) ++ { return count("offline"); } ++ ++}; ++ ++//}}} + + #endif /* CALIBRATE_H */ + diff --git a/kdump-multithreading-by-default.patch b/kdump-multithreading-by-default.patch new file mode 100644 index 0000000..c81c45c --- /dev/null +++ b/kdump-multithreading-by-default.patch @@ -0,0 +1,116 @@ +From: Petr Tesarik +Date: Fri Jun 23 13:47:28 2017 +0200 +Subject: Multithreading by default +References: bsc#1036223 +Upstream: v0.8.17 +Git-commit: 07534f44546e37c65a08fe7fb093255fbca6cd30 + +The "--num-threads" and "--split" makedumpfile options are mutually +exclusive. Before multithreading was implemented, "--split" was the +only way to use any additional CPUs. It makes more sense to use +multithreading by default. + +To use "--split", the SPLIT flag can be specified. + +Signed-off-by: Petr Tesarik + +--- + doc/man/kdump.5.txt.in | 16 +++++++++++----- + kdumptool/savedump.cc | 17 +++++++++++++++++ + kdumptool/savedump.h | 1 + + sysconfig.kdump.in | 5 +++-- + 4 files changed, 32 insertions(+), 7 deletions(-) + +--- a/doc/man/kdump.5.txt.in ++++ b/doc/man/kdump.5.txt.in +@@ -513,11 +513,17 @@ This is a space-separated list of flags + Because SFTP and FTP are not mounted, that option has no meaning when saving + the dump to SFTP and FTP. + +-*NOSPLIT*:: +- Disable the _--split_ option of *makedumpfile*(8). This option is normally +- added when KDUMP_CPUS>1, because otherwise the additional CPUs are idle. +- You can specify this flag to force the use of only one dumping process, +- regardless of the value of KDUMP_CPUS. ++*SPLIT*:: ++ If KDUMP_CPUS>1, use the _--split_ option of *makedumpfile*(8) instead of ++ the default _--num-threads_. ++ ++*SINGLE*:: ++ Specify this flag to force the use of only one CPU for dumping, regardless ++ of the value of KDUMP_CPUS. ++ It disables the _--split_ and _--num-threads_ options of *makedumpfile*(8). ++ ++ For compatibility with older versions, *NOSPLIT* is an alias for *SINGLE*. ++ Its use is deprecated. + + *XENALLDOMAINS*:: + When dumping a Xen virtualization host, *makedumpfile*(8) is normally +--- a/kdumptool/savedump.cc ++++ b/kdumptool/savedump.cc +@@ -291,11 +291,24 @@ void SaveDump::saveDump(const RootDirURL + cpus = syscpu.numOnline(); + } + if (!config->kdumptoolContainsFlag("NOSPLIT") && ++ !config->kdumptoolContainsFlag("SINGLE") && + cpus > 1) { + if (!useElf) + m_split = cpus; + else + cerr << "Splitting ELF dumps is not supported." << endl; ++ ++ if (config->kdumptoolContainsFlag("SPLIT")) { ++ if (!useElf) ++ m_split = cpus; ++ else ++ cerr << "Splitting ELF dumps is not supported." << endl; ++ } else { ++ if (!useElf) ++ m_threads = cpus - 1; ++ else ++ cerr << "Multithreading is unavailable for ELF dumps" << endl; ++ } + } + + bool excludeDomU = false; +@@ -313,6 +326,10 @@ void SaveDump::saveDump(const RootDirURL + cmdline << "makedumpfile "; + if (m_split) + cmdline << "--split "; ++ if (m_threads) { ++ SystemCPU syscpu; ++ cmdline << "--num-threads " << m_threads << " "; ++ } + cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " "; + cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " "; + if (excludeDomU) +--- a/kdumptool/savedump.h ++++ b/kdumptool/savedump.h +@@ -113,6 +113,7 @@ class SaveDump : public Subcommand { + bool m_usedDirectSave; + bool m_useMakedumpfile; + unsigned long m_split; ++ unsigned long m_threads; + std::string m_crashtime; + std::string m_crashrelease; + std::string m_rootdir; +--- a/sysconfig.kdump.in ++++ b/sysconfig.kdump.in +@@ -271,14 +271,15 @@ KDUMP_POSTSCRIPT="" + # + KDUMP_COPY_KERNEL="yes" + +-## Type: string(NOSPARSE,NOSPLIT,XENALLDOMAINS) ++## Type: string(NOSPARSE,SPLIT,SINGLE,XENALLDOMAINS) + ## Default: "" + ## ServiceRestart: kdump + # + # Space-separated list of flags to tweak the run-time behaviour of kdumptool: + # + # NOSPARSE disable creation of sparse files. +-# NOSPLIT do not pass "--split" to makedumpfile even if KDUMP_CPUS > 1 ++# SPLIT split the dump file with "makedumpfile --split" ++# SINGLE use single CPU to save the dump + # XENALLDOMAINS do not filter out Xen DomU pages + # + # See also: kdump(5). diff --git a/kdump-remount-sysroot-readwrite.patch b/kdump-remount-sysroot-readwrite.patch new file mode 100644 index 0000000..460a3d0 --- /dev/null +++ b/kdump-remount-sysroot-readwrite.patch @@ -0,0 +1,69 @@ +From: Michal Suchanek +Date: Wed Jun 21 15:23:30 2017 +0200 +Subject: Remount /sysroot readwrite when used for kdump +References: bsc#1034169 +Upstream: v0.8.17 +Git-commit: b3e40e6cb5794e441ddabf1de88f3729ebd0cc6f + +When kdump is saved to / (ie /var is not separate filesystem) /kdump/mnt0 is +bind mount of readonly /sysroot. Due to mount bug "mount /kdump/mnt0 -o +remount,rw" does nothing. + +Remount the device by hand with "mount none /kdump/mnt0 -o remount,rw" which +avoids the bug. + +Based on patch by Neil Brown + +Signed-off-by: Michal Suchanek + +--- kdump-0.8.16/init/save_dump.sh~ 2017-06-15 14:47:33.059006747 +0200 ++++ kdump-0.8.16/init/save_dump.sh 2017-06-15 14:47:42.827155243 +0200 +@@ -127,13 +127,38 @@ + check_for_device "$@" + } + ++function rw_fixup() ++{ ++ # handle remounting existing readonly mounts readwrite ++ # mount -a works only for not yet mounted filesystems ++ # remounting bind mounts needs special incantation ++ while read dev mpt fs opt dummy ; do ++ case "$opt" in ++ *bind*) ++ if [ "$fs" = "none" ] && ! [ -w "$mpt" ]; then ++ mount none "$mpt" -o remount,rw ++ fi ++ ;; ++ ro,* | *,ro,* | *,ro) ;; ++ *) ++ if ! [ -w "$mpt" ]; then ++ mount "$mpt" -o remount,rw ++ fi ++ ;; ++ esac ++ done < /etc/fstab ++} ++ + # + # Mounts all partitions listed in /etc/fstab.kdump + function mount_all() + { + local ret=0 + +- test -f /etc/fstab.kdump || return 0 ++ if ! [ -f /etc/fstab.kdump ] ; then ++ rw_fixup ++ return 0 ++ fi + + if [ -f /etc/fstab ] ; then + mv /etc/fstab /etc/fstab.orig +@@ -143,6 +167,8 @@ + mount -a + ret=$? + ++ rw_fixup ++ + if [ -f /etc/fstab.orig ] ; then + mv /etc/fstab.orig /etc/fstab + else diff --git a/kdump-source-save_dump.patch b/kdump-source-save_dump.patch new file mode 100644 index 0000000..5c99241 --- /dev/null +++ b/kdump-source-save_dump.patch @@ -0,0 +1,25 @@ +From: Michal Suchanek +Date: Wed Jun 21 15:33:01 2017 +0200 +Subject: Source save_dump.sh in systemd service. +References: bcs#1034169 +Upstream: v0.8.17 +Git-commit: b053165dd633978b1a78f6f7f993d34a62ee97c3 + +save_dump.sh is designed to be sourced and contains a number of toplevel return +statements. Bash will complain when these are executed unless the script is +sourced so source it to prevent useless noise. + +Reported-by: Neil Brown +Signed-off-by: Michal Suchanek + +--- kdump-0.8.16/init/kdump-save.service.in~ 2016-10-05 09:37:12.000000000 +0200 ++++ kdump-0.8.16/init/kdump-save.service.in 2017-06-01 17:04:00.428710624 +0200 +@@ -17,7 +17,7 @@ + + [Service] + Type=oneshot +-ExecStart=/lib/kdump/save_dump.sh ++ExecStart=/bin/bash -c "source /lib/kdump/save_dump.sh" + StandardInput=tty + StandardOutput=tty + StandardError=tty diff --git a/kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch b/kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch new file mode 100644 index 0000000..2a194ce --- /dev/null +++ b/kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch @@ -0,0 +1,176 @@ +From: Petr Tesarik +Date: Fri Jun 23 13:43:15 2017 +0200 +Subject: Treat KDUMP_CPUS=0 as "all available CPUs" +References: bsc#1036223 +Upstream: v0.8.17 +Git-commit: 34192abe9a0f5ddbcd580fa52b7fa4400533b9a4 + +Since SMP after crash is now considered stable, remove the warnings and +make the feature more useful by not requiring a fixed number of CPUs. + +Signed-off-by: Petr Tesarik + +--- + doc/man/kdump.5.txt.in | 7 +++---- + init/load.sh | 7 +++++-- + kdumptool/calibrate.cc | 6 +++--- + kdumptool/savedump.cc | 23 ++++++++++++++--------- + kdumptool/savedump.h | 2 +- + sysconfig.kdump.in | 7 +------ + 6 files changed, 27 insertions(+), 25 deletions(-) + +--- a/doc/man/kdump.5.txt.in ++++ b/doc/man/kdump.5.txt.in +@@ -136,13 +136,12 @@ the number of CPUs in your system. + This parameter modifies the _maxcpus_ parameter of the kdump kernel and + the number of *makedumpfile*(8) processes created. + ++If the value is zero, all available CPUs are used, i.e. the _maxcpus_ ++parameter is not added to the kdump kernel command line. ++ + *Note:* This parameter does not work properly for the _ELF_ format, + because *makedumpfile*(8) does not support split _ELF_ dump files. + +-*WARNING:* SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL! +-SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION +-OF THE DUMP KERNEL IF KDUMP_CPUS > 1. +- + Default is 1. + + +--- a/init/load.sh ++++ b/init/load.sh +@@ -63,14 +63,17 @@ function build_kdump_commandline() + local commandline="$KDUMP_COMMANDLINE" + + if [ -z "$commandline" ] ; then +- local nr_cpus=$(cpus_param "$kdump_kernel") ++ local nr_cpus + commandline=$( + remove_from_commandline \ + 'root|resume|crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable|unknown_nmi_panic|rd\.udev\.children-max' \ + < /proc/cmdline) ++ if [ ${KDUMP_CPUS:-1} -ne 0 ] ; then ++ nr_cpus=$(cpus_param "$kdump_kernel")=${KDUMP_CPUS:-1} ++ fi + # Use deadline for saving the memory footprint + commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory" +- commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}" ++ commandline="$commandline irqpoll ${nr_cpus}" + commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8" + case $(uname -i) in + i?86|x86_64) +--- a/kdumptool/calibrate.cc ++++ b/kdumptool/calibrate.cc +@@ -905,10 +905,10 @@ void Calibrate::execute() + } + + // Add memory based on CPU count +- unsigned long cpus; +- if (CAN_REDUCE_CPUS) { ++ unsigned long cpus = 0; ++ if (CAN_REDUCE_CPUS) + cpus = config->KDUMP_CPUS.value(); +- } else { ++ if (!cpus) { + SystemCPU syscpu; + unsigned long online = syscpu.numOnline(); + unsigned long offline = syscpu.numOffline(); +--- a/kdumptool/savedump.cc ++++ b/kdumptool/savedump.cc +@@ -41,6 +41,7 @@ + #include "identifykernel.h" + #include "email.h" + #include "routable.h" ++#include "calibrate.h" + + using std::string; + using std::list; +@@ -60,7 +61,7 @@ using std::ifstream; + SaveDump::SaveDump() + throw () + : m_dump(DEFAULT_DUMP), m_transfer(NULL), m_usedDirectSave(false), +- m_useMakedumpfile(false), m_useSplit(false), m_nomail(false) ++ m_useMakedumpfile(false), m_split(0), m_nomail(false) + { + Debug::debug()->trace("SaveDump::SaveDump()"); + +@@ -284,10 +285,15 @@ void SaveDump::saveDump(const RootDirURL + if (noDump) + return; // nothing to be done + ++ unsigned long cpus = config->KDUMP_CPUS.value(); ++ if (cpus) { ++ SystemCPU syscpu; ++ cpus = syscpu.numOnline(); ++ } + if (!config->kdumptoolContainsFlag("NOSPLIT") && +- config->KDUMP_CPUS.value() > 1) { ++ cpus > 1) { + if (!useElf) +- m_useSplit = true; ++ m_split = cpus; + else + cerr << "Splitting ELF dumps is not supported." << endl; + } +@@ -305,7 +311,7 @@ void SaveDump::saveDump(const RootDirURL + // use makedumpfile + ostringstream cmdline; + cmdline << "makedumpfile "; +- if (m_useSplit) ++ if (m_split) + cmdline << "--split "; + cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " "; + cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " "; +@@ -340,10 +346,9 @@ void SaveDump::saveDump(const RootDirURL + provider->setProgress(&progress); + else + cout << "Saving dump ..." << endl; +- if (m_useSplit) { ++ if (m_split) { + StringVector targets; +- const int cpus = config->KDUMP_CPUS.value(); +- for (int i = 1; i <= cpus; ++i) { ++ for (unsigned long i = 1; i <= m_split; ++i) { + ostringstream ss; + ss << "vmcore" << i; + targets.push_back(ss.str()); +@@ -482,8 +487,8 @@ void SaveDump::generateInfo() + ss << "Dump level : " + << Stringutil::number2string(config->KDUMP_DUMPLEVEL.value()) << endl; + ss << "Dump format : " << config->KDUMP_DUMPFORMAT.value() << endl; +- if (m_useSplit && m_usedDirectSave) +- ss << "Split parts : " << config->KDUMP_CPUS.value() << endl; ++ if (m_split && m_usedDirectSave) ++ ss << "Split parts : " << m_split << endl; + ss << endl; + + +--- a/kdumptool/savedump.h ++++ b/kdumptool/savedump.h +@@ -112,7 +112,7 @@ class SaveDump : public Subcommand { + Transfer *m_transfer; + bool m_usedDirectSave; + bool m_useMakedumpfile; +- bool m_useSplit; ++ unsigned long m_split; + std::string m_crashtime; + std::string m_crashrelease; + std::string m_rootdir; +--- a/sysconfig.kdump.in ++++ b/sysconfig.kdump.in +@@ -18,13 +18,8 @@ KDUMP_KERNELVER="" + # + # Number of CPUs to be used in the kdump environment. You may want to + # increase the number if computing power is the bottleneck in your setup. +-# This value is used as the maxcpus parameter of the secondary kernel, so +-# DON'T CHANGE IT unless your system can reliably re-initialize SMP after +-# a kernel crash. + # +-# WARNING: SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL! +-# SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION +-# OF THE DUMP KERNEL IF KDUMP_CPUS > 1. ++# If the value is zero, use all available CPUs. + # + # See also: kdump(5). + # diff --git a/kdump.changes b/kdump.changes index ff82ea5..d579fec 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,63 @@ +------------------------------------------------------------------- +Thu Jun 29 16:31:26 UTC 2017 - ptesarik@suse.com + +- kdump-activate-QETH-devices.patch: Activate QETH network devices + (bsc#1038669). + +------------------------------------------------------------------- +Tue Jun 27 06:06:54 UTC 2017 - ptesarik@suse.com + +- Drop kdump-do-not-reload-FADUMP-on-CPU-memory-hotplug.patch: + Reload is needed even with fadmp (bsc#1040567). + +------------------------------------------------------------------- +Mon Jun 26 11:24:47 UTC 2017 - ptesarik@suse.com + +- kdump-fail-if-fadump-cannot-be-registered.patch: Fail at startup + if fadump cannot be registered (bsc#1040567). +- kdump-do-not-reload-FADUMP-on-CPU-memory-hotplug.patch: Do not + reload on CPU/memory hotplug when using FADUMP (bsc#1040567). + +------------------------------------------------------------------- +Fri Jun 23 12:56:45 UTC 2017 - ptesarik@suse.com + +- kdump-explicitly-request-zFCP-devices.patch: Explicitly request + zFCP devices in kdump initrd (bsc#1008352). + +------------------------------------------------------------------- +Fri Jun 23 11:51:11 UTC 2017 - ptesarik@suse.com + +- kdump-move-class-SystemCPU-to-header-file.patch: Move class + SystemCPU to a header file (bsc#1036223). +- kdump-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch: Treat + KDUMP_CPUS=0 as "all available CPUs" (bsc#1036223). +- kdump-multithreading-by-default.patch: Use multithreading by + default (bsc#1036223). + +------------------------------------------------------------------- +Thu Jun 22 12:42:50 UTC 2017 - ptesarik@suse.com + +- kdump-fix-save_dump-to-NFS.patch: Fix save_dump to NFS targets + (bsc#1045541). +- kdump-invoke-subcommand-destructors-on-exit.patch: Invoke + subcommand destructors on exit (bsc#1045541). + +------------------------------------------------------------------- +Fri Jun 16 12:04:14 UTC 2017 - msuchanek@suse.com + +- kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch + Releasing fadump memory can take a long time so skip it when + rebooting anyway (bsc#1040610). + +------------------------------------------------------------------- +Tue Jun 15 12:55:34 UTC 2017 - msuchanek@suse.com + +- kdump-do-not-check-bind-mount.patch: Do not request filesystem + check on bind mounts (bsc#1034169). +- kdump-remount-sysroot-readwrite.patch: Also remount writable + any mounts that were already mounted readonly by systemd + (bsc#1034169). + ------------------------------------------------------------------- Wed Jun 14 12:48:34 UTC 2017 - ptesarik@suse.com @@ -25,6 +85,14 @@ Wed Jun 7 11:43:46 UTC 2017 - ptesarik@suse.com - kdump-aarch64.patch: kdumptool: add aarch64 (bsc#1033464). +------------------------------------------------------------------- +Thu Jun 1 14:50:25 UTC 2017 - msuchanek@suse.com + +- kdump-source-save_dump.patch: save_dump.sh is designed to be + sourced and has numerous toplevel return statements. Source it + from the service definition as well to prevent bash complaints. + (bcs#1034169). + ------------------------------------------------------------------- Wed May 17 13:31:11 UTC 2017 - ptesarik@suse.com @@ -154,7 +222,7 @@ Tue Sep 23 14:17:01 UTC 2014 - ptesarik@suse.cz - kdump-add-IPv6-KDUMP_NETCONFIG-modes.patch: Add KDUMP_NETCONFIG modes to support IPv6 (bnc#885897). ------------------------------------------------------------------- +------------------------------------------------------------------- Mon Sep 22 15:32:22 UTC 2014 - ptesarik@suse.cz - kdump-get-multipath-wwid-from-sysfs.patch: Get required multipath diff --git a/kdump.spec b/kdump.spec index 043d895..d85fa2a 100644 --- a/kdump.spec +++ b/kdump.spec @@ -55,6 +55,18 @@ Patch10: %{name}-fix-service-files.patch Patch11: %{name}-Routable-preferred-source-address.patch Patch12: %{name}-URLTransfer-complete-target.patch Patch13: %{name}-prepend-IP-address.patch +Patch14: %{name}-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch +Patch15: %{name}-do-not-check-bind-mount.patch +Patch16: %{name}-source-save_dump.patch +Patch17: %{name}-remount-sysroot-readwrite.patch +Patch18: %{name}-fix-save_dump-to-NFS.patch +Patch19: %{name}-invoke-subcommand-destructors-on-exit.patch +Patch20: %{name}-move-class-SystemCPU-to-header-file.patch +Patch21: %{name}-treat-KDUMP_CPUS-0-as-all-available-CPUs.patch +Patch22: %{name}-multithreading-by-default.patch +Patch23: %{name}-explicitly-request-zFCP-devices.patch +Patch24: %{name}-fail-if-fadump-cannot-be-registered.patch +Patch25: %{name}-activate-QETH-devices.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -128,6 +140,18 @@ cp %{S:1} tests/data/ %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 %build export CFLAGS="%{optflags}"