Accepting request 757546 from Kernel:kdump

Add relevant SLE bug fixes.

OBS-URL: https://build.opensuse.org/request/show/757546
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kdump?expand=0&rev=108
This commit is contained in:
Dominique Leuenberger 2019-12-24 13:29:17 +00:00 committed by Git OBS Bridge
commit 6eb5bc7cc5
16 changed files with 981 additions and 3 deletions

View File

@ -0,0 +1,44 @@
From: Nick Wang <nwang@suse.com>
Date: Wed, 28 Nov 2018 18:07:56 +0800
Subject: Add fence_kdump_send when fence-agents installed.
References: bsc#1108919
Upstream: merged
Git-commit: 93822c5ee738e186a3a70f6d7a6e59bdea4b46b1
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 5 +++++
init/setup-kdump.functions | 7 +++++++
2 files changed, 12 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,6 +25,11 @@ kdump_check_net() {
elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
# always set up network
kdump_neednet=y
+ elif [ -f "/usr/lib/fence_kdump_send" ] &&
+ ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
+ [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ # setup network when fence_kdump_send included and configured
+ kdump_neednet=y
else
kdump_neednet=
for protocol in "${kdump_Protocol[@]}" ; do
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -917,6 +917,13 @@ function kdump_modify_config() #
KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
fi
+ # copy fence_kdump_send if exists
+ if [ -f "/usr/lib/fence_kdump_send" ] &&
+ ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
+ [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS /usr/lib/fence_kdump_send"
+ fi
+
# make sure NSS works somehow
cp /etc/hosts "${dest}/etc"
{ cat <<-EOF

View File

@ -0,0 +1,109 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 20 Nov 2018 10:23:28 +0100
Subject: Add ":force" option to KDUMP_NETCONFIG
References: bsc#1108919
Upstream: merged
Git-commit 4e112a28055a57dbcdf9a72c4bdcf586296ec81a
Make it possible to force network setup in kdump initrd by adding a
":force" suffix to KDUMP_NETCONFIG. This is needed to configure
fence_kdump.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 6 ++++++
init/module-setup.sh | 37 +++++++++++++++++++++----------------
sysconfig.kdump.in | 6 +++++-
3 files changed, 32 insertions(+), 17 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -544,6 +544,12 @@ Auto-detection cannot be used to set up
because of limitations in the implementation of the _ip=_ initrd command line
option.
+Network is configured only if needed, e.g. the dump target is on a remote
+machine, or an email notification should be sent. If network is needed by
+something else, such as a custom script used as KDUMP_PRESCRIPT or
+KDUMP_POSTSCRIPT, add a _:force_ suffix to the network configuration, for
+example "auto:force" or "eth0:dhcp4:force".
+
Use a _netdevice:mode_ string to force a specific network device to be used. A
_netdevice_ is for example "eth0". The _mode_ can be:
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -19,20 +19,25 @@ kdump_needed() {
}
kdump_check_net() {
- kdump_neednet=
- for protocol in "${kdump_Protocol[@]}" ; do
- if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
- kdump_neednet=y
- fi
- done
+ if [ -z "$KDUMP_NETCONFIG" ]; then
+ # network explicitly disabled in configuration
+ kdump_neednet=
+ elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
+ # always set up network
+ kdump_neednet=y
+ else
+ kdump_neednet=
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
+ kdump_neednet=y
+ fi
+ done
- # network configuration
- if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
- kdump_neednet=y
+ # network configuration
+ if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
+ kdump_neednet=y
+ fi
fi
-
- # network explicitly disabled in configuration?
- [ -z "$KDUMP_NETCONFIG" ] && kdump_neednet=
}
kdump_get_fs_type() {
@@ -161,13 +166,13 @@ kdump_cmdline_zfcp() {
kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
- if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
+ local _cfg="${KDUMP_NETCONFIG%:force}"
+ if [ "$_cfg" = "auto" ] ; then
kdump_host_if=default
kdump_net_mode=auto
else
- set -- ${KDUMP_NETCONFIG//:/ }
- kdump_host_if=$1
- kdump_net_mode=$2
+ kdump_host_if="${_cfg%%:*}"
+ kdump_net_mode="${_cfg#*:}"
fi
if [ "$kdump_host_if" = "default" ] ; then
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -294,9 +294,13 @@ KDUMPTOOL_FLAGS=""
# that contains the network device and the mode (static, dhcp, dhcp6, auto6),
# separated by a colon. Example: "eth0:static" or "eth1:dhcp".
#
-# For static configuration, you have to add the configuration to
+# For static configuration, you may have to add the configuration to
# KDUMP_COMMANDLINE_APPEND.
#
+# By default, network is set up only if needed. Add ":force" to make sure
+# that network is always available (e.g. for use by a custom pre- or
+# post-script).
+#
# See also: kdump(5)
#
KDUMP_NETCONFIG="auto"

View File

@ -0,0 +1,152 @@
From e32374a88bb3b1dc0c5f493d6c1966558d996c4f Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 27 Nov 2018 14:52:06 +0100
Subject: Clean up the use of current vs. boot network interface names
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: e32374a88bb3b1dc0c5f493d6c1966558d996c4f
Strictly differentiate between the interface name as seen during
dracut execution and at boot time (in initrd environment).
Most importantly, it is necessary to store both names for generating
qeth udev rules.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 51 +++++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 24 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -426,9 +426,9 @@ function kdump_hwaddr() # {{{
local _type=$(<"/sys/class/net/$_iface/addr_assign_type")
if [ "$_type" -eq 0 ]
then
- cat "/sys/class/net/$kdump_iface/address"
+ cat "/sys/class/net/$_iface/address"
else
- ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//'
+ ethtool -P "$_iface" | sed 's/^[^:]*: *//'
fi
} # }}}
@@ -440,42 +440,43 @@ function kdump_hwaddr() # {{{
# kdump_netif corresponding ifname= initrd parameter added
# kdump_iface device name in initrd
# kdump_kmods additional kernel modules updated
-# kdump_hwif hardware interfaces updated
+# kdump_ifmap hardware network interface map updated
function kdump_ifname_config() # {{{
{
- kdump_iface="$1"
- local ifkind=$(kdump_ifkind "$kdump_iface")
+ local _iface="$1"
+ local _ifkind=$(kdump_ifkind "$_iface")
- if [ -z "$ifkind" ]
+ if [ -z "$_ifkind" ]
then
- kdump_hwif="$kdump_hwif $kdump_iface"
- local _drv=$( readlink "/sys/class/net/$kdump_iface/device/driver" )
+ kdump_iface="$_iface"
+ kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
+ local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
case "$_drv" in
*/qeth)
;;
*)
- local hwaddr=$(kdump_hwaddr "$kdump_iface")
+ local hwaddr=$(kdump_hwaddr "$_iface")
[ -n "$hwaddr" ] && kdump_netif="$kdump_netif ifname=$kdump_iface:$hwaddr"
;;
esac
- local mod="/sys/class/net/$kdump_iface/device/driver/module"
+ local mod="/sys/class/net/$_iface/device/driver/module"
if [ -L "$mod" ]
then
mod=$(readlink "$mod")
kdump_kmods="$kdump_kmods ${mod##*/}"
fi
else
- case "$ifkind" in
+ case "$_ifkind" in
bridge)
- kdump_bridge_config "$kdump_iface"
+ kdump_bridge_config "$_iface"
;;
bond)
- kdump_bond_config "$kdump_iface"
+ kdump_bond_config "$_iface"
;;
vlan)
- kdump_vlan_config "$kdump_iface"
+ kdump_vlan_config "$_iface"
;;
*)
return 1
@@ -1070,13 +1071,13 @@ 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
+# 2) _iface: current interface name
+# 3) _bootif: interface name in initrd
function kdump_setup_qeth() # {{{
{
local _root="$1"
local _iface="$2"
+ local _bootif="$3"
local _dev=$( readlink "/sys/class/net/$_iface/device" )
_dev="${_dev##*/}"
local _cdev0=$( readlink "/sys/class/net/$_iface/device/cdev0" )
@@ -1113,8 +1114,8 @@ ACTION=="add", SUBSYSTEM=="ccwgroup", KE
ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{online}="1"
EOF
- cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_iface}.rules" <<EOF
-SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_iface"
+ cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_bootif}.rules" <<EOF
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_bootif"
EOF
} # }}}
@@ -1123,18 +1124,20 @@ EOF
# Parameters:
# 1) _root: initrd temporary root
# Input variables:
-# kdump_hwif hardware network interfaces
+# kdump_ifmap hardware network interface map
function kdump_setup_hwif() # {{{
{
local _root="$1"
- local _iface _drv
+ local _spec _iface _bootif _drv
- for _iface in $kdump_hwif
+ for _spec in $kdump_ifmap
do
+ _iface="${_spec%:*}"
+ _bootif="${_spec##*:}"
_drv=$( readlink "/sys/class/net/$_iface/device/driver" )
case "$_drv" in
*/qeth)
- kdump_setup_qeth "$_root" "$_iface"
+ kdump_setup_qeth "$_root" "$_iface" "$_bootif"
;;
esac
done
@@ -1149,7 +1152,7 @@ function kdump_setup_hwif() # {{
# Input variables:
# KDUMP_* see kdump_get_config
# kdump_mnt[] mountpoints in kdump environment
-# kdump_hwif hardware network interfaces
+# kdump_ifmap hardware network interface map
# Output variables:
# KDUMP_REQUIRED_PROGRAMS updated as necessary
function kdump_setup_files() # {{{

View File

@ -0,0 +1,30 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 30 Nov 2018 09:29:10 +0100
Subject: Document kdump behaviour for fence_kdump_send
References: bsc#1108919
Upstream: merged
Git-commit: dcbe901dbec7d0b5e70014564da5a34f673e2248
Add an explanation paragraph to the manual page.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -483,7 +483,11 @@ KDUMP_POSTSCRIPT
~~~~~~~~~~~~~~~~
Program that is executed after taking the dump and before the system is
-rebooted. You have to include that program in KDUMP_POSTSCRIPT.
+rebooted. You have to include that program in KDUMP_REQUIRED_PROGRAMS.
+
+As a special case, if KDUMP_POSTSCRIPT contains +/usr/lib/fence_kdump_send+,
+this script is automatically added to the initrd, and network is configured by
+default.
Default: ""

View File

@ -0,0 +1,52 @@
From: Nick Wang <nwang@suse.com>
Date: Fri, 30 Nov 2018 10:03:17 +0800
Subject: Use var for path of fence_kdump_send and remove the unnecessary PRESCRIPT check
References: bsc#1108919
Upstream: merged
Git-commit: f69533d0d8e974b8c27a2c9a651fb9e98c16194b
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 5 ++---
init/setup-kdump.functions | 8 ++++----
2 files changed, 6 insertions(+), 7 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,9 +25,8 @@ kdump_check_net() {
elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
# always set up network
kdump_neednet=y
- elif [ -f "/usr/lib/fence_kdump_send" ] &&
- ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
- [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ elif [ -f "$FENCE_KDUMP_SEND" ] &&
+ [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
# setup network when fence_kdump_send included and configured
kdump_neednet=y
else
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -10,6 +10,7 @@
#
KDUMP_CONFIG=/etc/sysconfig/kdump
+FENCE_KDUMP_SEND=/usr/lib/fence_kdump_send
#
# Global variables
@@ -918,10 +919,9 @@ function kdump_modify_config() #
fi
# copy fence_kdump_send if exists
- if [ -f "/usr/lib/fence_kdump_send" ] &&
- ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
- [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
- KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS /usr/lib/fence_kdump_send"
+ if [ -f "$FENCE_KDUMP_SEND" ] &&
+ [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
+ KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS $FENCE_KDUMP_SEND"
fi
# make sure NSS works somehow

View File

@ -0,0 +1,43 @@
From c5a6c610e1b3b4ce34a8769b7772a682fb826bda Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 29 Nov 2018 12:54:57 +0100
Subject: Use a custom namespace for physical NICs
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: c5a6c610e1b3b4ce34a8769b7772a682fb826bda
To prevent rename conflicts, use kdumpX as the interface name
instead of the current name.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -11,6 +11,13 @@
KDUMP_CONFIG=/etc/sysconfig/kdump
+#
+# Global variables
+#
+
+# Next network interface number
+kdump_ifnum=0
+
# Extract the device name from a route
#
# Input:
@@ -448,7 +455,8 @@ function kdump_ifname_config() #
if [ -z "$_ifkind" ]
then
- kdump_iface="$_iface"
+ kdump_iface="kdump$kdump_ifnum"
+ kdump_ifnum=$(( $kdump_ifnum + 1 ))
kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )

View File

@ -0,0 +1,145 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 17 Dec 2019 10:49:19 +0100
Subject: calibrate: Update values
References: bsc#1130529
Upstream: merged
Git-commit: 898b9e7fb7f80bd19268678b4abaf74792a3c229
Kernel base image has grown by approx. 20%.
Unpacked initramfs has grown by approx. 50%.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 56 ++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -58,10 +58,10 @@
//
#if defined(__x86_64__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(32)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(38)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -69,10 +69,10 @@
# define PERCPU_KB 108
#elif defined(__i386__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(28)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(34)
# define KERNEL_INIT_KB MB(4)
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
@@ -80,10 +80,10 @@
# define PERCPU_KB 56
#elif defined(__powerpc64__)
-# define DEF_RESERVE_KB MB(256)
-# define KERNEL_KB MB(32)
+# define DEF_RESERVE_KB MB(384)
+# define KERNEL_KB MB(38)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(58)
+# define INIT_KB MB(87)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD MB(128)
@@ -91,10 +91,10 @@
# define PERCPU_KB 172 // FIXME: is it non-linear?
#elif defined(__powerpc__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD MB(128)
@@ -102,10 +102,10 @@
# define PERCPU_KB 0 // TODO !!!
#elif defined(__s390x__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(26)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(31)
# define KERNEL_INIT_KB 512
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -115,10 +115,10 @@
# define align_memmap s390x_align_memmap
#elif defined(__s390__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB 512
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
@@ -128,10 +128,10 @@
# define align_memmap s390_align_memmap
#elif defined(__ia64__)
-# define DEF_RESERVE_KB MB(512)
-# define KERNEL_KB MB(64)
+# define DEF_RESERVE_KB MB(768)
+# define KERNEL_KB MB(77)
# define KERNEL_INIT_KB MB(3)
-# define INIT_KB MB(44)
+# define INIT_KB MB(66)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -139,21 +139,21 @@
# define PERCPU_KB 0 // TODO !!!
#elif defined(__aarch64__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(26)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(31)
# define KERNEL_INIT_KB MB(1)
-# define INIT_KB MB(29)
-# define INIT_NET_KB MB(2)
+# define INIT_KB MB(51)
+# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!
#elif defined(__arm__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB MB(1)
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0

View File

@ -0,0 +1,41 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 2 Sep 2019 10:01:47 +0200
Subject: Make sure that kdump mount points are cleaned up
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit 83e48556428339668e6f23e1dccc0196a52d1b68
If the system continues to boot, kdump mount points must be
unmounted before switching to the system root. Otherwise, some
filesystems may remain mounted under the now-unavailable initrd
root, keeping the underlying devices busy during system shutdown.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -246,7 +246,19 @@ install() {
gsub(/@KDUMP_MOUNTPOINTS@/, mountpoints)
print
}' "$moddir/kdump-save.service.in" > \
- "$initdir/$systemdsystemunitdir"/kdump-save.service
+ "$initdir/$systemdsystemunitdir"/kdump-save.service
+
+ local _d _mp
+ _d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
+ mkdir -p "$_d"
+ (
+ echo "[Unit]"
+ for _mp in "${kdump_mnt[@]}" ; do
+ echo -n "Conflicts="
+ systemd-escape -p --suffix=mount "$_mp"
+ done
+ ) > "$_d"/kdump.conf
+
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else

View File

@ -1,7 +1,7 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 25 Oct 2018 10:02:43 +0200
Subject: Fix multipath configuration with user_friendly_names and/or aliases
References: bsc#1111207, LTC#171953, bsc#1125218, LTC#175465
References: bsc#1111207, LTC#171953, bsc#1125218, LTC#175465, bsc#1153601
Upstream: merged
Git-commit: 4b4dacfddd456a51c04a878e31d4544223ea9701

67
kdump-nss-modules.patch Normal file
View File

@ -0,0 +1,67 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 14 Nov 2019 19:13:39 +0100
Subject: Improve the handling of NSS
References: bsc#1021846
Upstream: merged
Git-commit 598d7517ccbbf29dc51e0a9c14146722d2324731
The current code mostly works, but can be improved in two ways:
1. Only the 'hosts' database is really needed in the kdump
environment, and its settings should be copied from the running
system. The openSSH client also needs 'passwd' (and maybe
'group'), but it is not necessary to handle fancy setups (such
as NIS or AD). The client merely requires that UID 0 can be
translated to a user name. The 'file' service is more than
sufficient for that purpose.
2. The NSS configuration file may not contain configuration of all
categories. If configuration for a given category is missing,
glibc will use a default setting, but kdump will not install
the corresponding modules. Fix it by adding the glibc default
to the configuration file explicitly if needed.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -892,8 +892,6 @@ function kdump_modify_config() #
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
elif [ "$protocol" != "srcfile" ] ; then
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
- cp /etc/hosts "${dest}/etc"
- grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
fi
#
@@ -919,6 +917,26 @@ function kdump_modify_config() #
KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
fi
+ # make sure NSS works somehow
+ cp /etc/hosts "${dest}/etc"
+ { cat <<-EOF
+ passwd: files
+ shadow: files
+ group: files
+EOF
+ grep '^[[:space:]]*hosts:' /etc/nsswitch.conf \
+ || echo 'hosts: dns [!UNAVAIL=return] files'
+ } > "${dest}/etc/nsswitch.conf"
+
+ # install necessary NSS modules
+ local _nssmods=$(
+ sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
+ "${dest}/etc/nsswitch.conf" \
+ | tr -s '[:space:]' '\n' | sort -u | tr '\n' '|' )
+ _nssmods=${_nssmods#|}
+ _nssmods=${_nssmods%|}
+ inst_libdir_file -n "/libnss_($_nssmods)" 'libnss_*.so*'
+
#
# dump the configuration file, modifying:
# KDUMP_SAVEDIR -> resolved path

View File

@ -0,0 +1,33 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 6 Dec 2019 09:54:57 +0100
Subject: powerpc: Do not reload on CPU hot removal
References: bsc#1133407, LTC#176111
Git-commit: d1c4f630f0da0bf43928e3c975f02e832b2df50f
Skipping reload after a CPU goes offline does not have any adverse
impact, as /sys/devices/system/cpu/cpuX nodes are present for all
"possible" CPUs on PPC64.
The udev rule for CPU online operation is still needed. If reload
is skipped and the system crashes on a hot-added CPU, the kdump
kernel fails to get the 'boot_cpuid' after a hot plug and
eventually fails (see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file).
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
70-kdump.rules.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/70-kdump.rules.in
+++ b/70-kdump.rules.in
@@ -13,7 +13,7 @@
SUBSYSTEM=="memory", ACTION=="add|remove", GOTO="kdump_try_restart"
@if @ARCH@ ppc ppc64 ppc64le
-SUBSYSTEM=="cpu", ACTION=="online|offline", GOTO="kdump_try_restart"
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_try_restart"
@endif
GOTO="kdump_end"

View File

@ -0,0 +1,86 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 16 Dec 2019 13:33:19 +0100
Subject: Prefer by-path and device-mapper aliases over kernel names
References: bsc#1101149, LTC#168532
Upsream: merged
Git-commit: f153c9ac3f1baf8d1cf66c901b41f7bff19ff528
Mounting by kernel names (e.g. /dev/sda) is generally broken, since
these names are allocated dynamically by the kernel and may change
after a panic kexec. This issue can be usually avoided by using a
more stable tag in /etc/fstab (e.g. UUID=xyz).
However, there are supported ways to mount a filesystem with no
corresponding line in /etc/fstab, and kdump uses /proc/mounts as
fallback. This file shows the block device using the name that was
given as argument to the mount syscall. This name is usually
translated to the kernel name by libblkid(3). As a result, it does
not reflect the original intention, e.g.:
ezekiel:~ # mount UUID=9A4D-9B2B /mnt/data/
ezekiel:~ # grep /mnt/data /proc/mounts
/dev/sda /mnt/data vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
ezekiel:~ # grep /mnt/data /proc/self/mountinfo
187 94 8:0 / /mnt/data rw,relatime shared:56 - vfat /dev/sda rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
As the original intention cannot be recovered, it is probably
better to prefer the by-path alias. The semantic of this alias is
closest to the traditional UNIX use of raw block device names: it's
always the drive attached to a known physical connector, regardless
of which medium is inserted.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 3 ++-
init/setup-kdump.functions | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -90,7 +90,8 @@ kdump_add_mnt() {
mkdir -p "$initdir/etc"
local _passno=2
[ "${kdump_fstype[_idx]}" = nfs ] && _passno=0
- echo "${kdump_dev[_idx]} ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
+ _dev=$(kdump_mount_dev "${kdump_dev[_idx]}")
+ echo "$_dev ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
}
check() {
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -716,6 +716,33 @@ function kdump_get_targets() # {
} # }}}
#
+# Get a block device specification that is suitable for use as the
+# first column in /etc/fstab.
+# Since device node names may change after kexec, more stable symlink
+# are preferred (by-path alias or device mapper name).
+# Parameters:
+# 1) _dev: block device specification
+# Output:
+# block device specification to be used in /etc/fstab
+function kdump_mount_dev() # {{{
+{
+ local _dev="$1"
+
+ if [ ! -L "$_dev" -a -b "$_dev" ] ; then
+ local _symlink
+ for _symlink in $(udevadm info --root --query=symlink "$_dev")
+ do
+ case "$_symlink" in
+ */by-path/*|*/mapper/*)
+ _dev="$_symlink"
+ break
+ esac
+ done
+ fi
+ echo "$_dev"
+} # }}}
+
+#
# Read and normalize /etc/fstab and /proc/mounts (if exists).
# The following transformations are done:
# - initial TABs and SPACEs are removed

View File

@ -0,0 +1,48 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, Nov 12 2019 14:53:37 +0100
Subject: Preserve white space when removing kernel command line options
References: bsc#1117652
Upstream: merged
Git-commit: 23d593b54a9c97a204ea7412e53c60d3d3852cab
The function was originally designed to remove unwanted options
from the panic kernel command line. It is now also used to check
whether the current command line contains a fadump option or not,
but the check is broken, because remove_from_commandline() may
change the amount (and type) of white space. For example, it
always adds an extra space if the original string ends with a
space.
Modify the function to copy original separators verbatim, except
that any white space preceding the removed option is removed.
Fixes: a4718a2c7b714d0594903fc8dc5ae47252a9b9ba
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -17,15 +17,13 @@ function remove_from_commandline()
awk 'BEGIN { ORS="" }
{
while(length()) {
- sub(/^[[:space:]]+/,"");
- pstart=match($0,/("[^"]*"?|[^"[:space:]])+/);
- plength=RLENGTH;
- param=substr($0,pstart,plength);
- raw=param;
+ match($0,/^([[:space:]]*)(.*)/,w);
+ match(w[2],/(("[^"]*"?|[^"[:space:]])+)(.*)/,p);
+ raw=p[1];
gsub(/"/,"",raw);
if (raw !~ /^('"$option"')(=|$)/)
- print param " ";
- $0=substr($0,pstart+plength);
+ print w[1] p[1];
+ $0=p[3];
}
print "\n";
}'

View File

@ -0,0 +1,40 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 2 Sep 2019 15:27:24 +0200
Subject: Skip kdump-related mounts if there is no /proc/vmcore
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit b91c1e16d373e5631ce725acf52db097d8248389
With FADUMP, the same initrd is used for saving a dump and for
normal boot. It is not necessary to mount kdump-related filesystems
on a normal boot, so let's add a systemd condition.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -249,13 +249,18 @@ install() {
"$initdir/$systemdsystemunitdir"/kdump-save.service
local _d _mp
+ local _mnt
_d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
mkdir -p "$_d"
(
echo "[Unit]"
for _mp in "${kdump_mnt[@]}" ; do
- echo -n "Conflicts="
- systemd-escape -p --suffix=mount "$_mp"
+ _mnt=$(systemd-escape -p --suffix=mount "$_mp")
+ _d="$initdir/$systemdsystemunitdir/$_mnt".d
+ mkdir -p "$_d"
+ echo -e "[Unit]\nConditionPathExists=/proc/vmcore" \
+ > "$_d"/kdump.conf
+ echo "Conflicts=$_mnt"
done
) > "$_d"/kdump.conf

View File

@ -1,3 +1,65 @@
-------------------------------------------------------------------
Tue Dec 17 10:00:30 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-calibrate-Update-values.patch: calibrate: Update values
(bsc#1130529).
-------------------------------------------------------------------
Tue Dec 17 09:59:08 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-prefer-by-path-and-device-mapper.patch: Prefer by-path and
device-mapper aliases over kernel device names (bsc#1101149,
LTC#168532).
-------------------------------------------------------------------
Fri Dec 13 15:11:32 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-powerpc-no-reload-on-CPU-removal.patch: powerpc: Do not
reload on CPU hot removal (bsc#1133407, LTC#176111).
-------------------------------------------------------------------
Fri Dec 13 14:04:26 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-Add-force-option-to-KDUMP_NETCONFIG.patch: Add ":force"
option to KDUMP_NETCONFIG (bsc#1108919).
- kdump-Add-fence_kdump_send-when-fence-agents-installed.patch: Add
fence_kdump_send when fence-agents installed (bsc#1108919).
- kdump-FENCE_KDUMP_SEND-variable.patch: Use var for path of
fence_kdump_send and remove the unnecessary PRESCRIPT check
(bsc#1108919).
- kdump-Document-fence_kdump_send.patch: Document kdump behaviour
for fence_kdump_send (bsc#1108919).
-------------------------------------------------------------------
Mon Dec 9 09:57:37 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-nss-modules.patch: Improve the handling of NSS
(bsc#1021846).
-------------------------------------------------------------------
Mon Dec 9 09:54:01 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-skip-mounts-if-no-proc-vmcore.patch: Skip kdump-related
mounts if there is no /proc/vmcore (bsc#1102252, bsc#1125011).
- kdump-clean-up-kdump-mount-points.patch: Make sure that kdump
mount points are cleaned up (bsc#1102252, bsc#1125011).
-------------------------------------------------------------------
Fri Dec 6 16:50:06 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch:
Clean up the use of current vs. boot network interface names
(bsc#1094444, bsc#1116463, bsc#1141064).
- kdump-Use-a-custom-namespace-for-physical-NICs.patch: Use a
custom namespace for physical NICs (bsc#1094444, bsc#1116463,
bsc#1141064).
-------------------------------------------------------------------
Fri Dec 6 10:49:48 UTC 2019 - Petr Tesařík <ptesarik@suse.com>
- kdump-preserve-white-space.patch: Preserve white space when
removing kernel command line options (bsc#1117652).
-------------------------------------------------------------------
Tue Nov 12 08:11:26 UTC 2019 - Jiri Slaby <jslaby@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package kdump
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -43,7 +43,7 @@ Release: 0
Summary: Script for kdump
License: GPL-2.0-or-later
Group: System/Kernel
Url: https://github.com/openSUSE/kdump
URL: https://github.com/openSUSE/kdump
Source: %{name}-%{version}.tar.bz2
Source2: %{name}-rpmlintrc
Patch1: %{name}-fillupdir-fixes.patch
@ -63,6 +63,19 @@ Patch14: %{name}-fix-multipath-user_friendly_names.patch
Patch15: %{name}-Add-skip_balance-option-to-BTRFS-mounts.patch
Patch16: %{name}-kdumprd-Look-for-boot-image-and-boot-Image.patch
Patch17: %{name}-savedump-search-also-for-vmlinux.xz.patch
Patch18: %{name}-preserve-white-space.patch
Patch19: %{name}-Clean-up-the-use-of-current-vs-boot-network-iface.patch
Patch20: %{name}-Use-a-custom-namespace-for-physical-NICs.patch
Patch21: %{name}-clean-up-kdump-mount-points.patch
Patch22: %{name}-skip-mounts-if-no-proc-vmcore.patch
Patch23: %{name}-nss-modules.patch
Patch24: %{name}-Add-force-option-to-KDUMP_NETCONFIG.patch
Patch25: %{name}-Add-fence_kdump_send-when-fence-agents-installed.patch
Patch26: %{name}-FENCE_KDUMP_SEND-variable.patch
Patch27: %{name}-Document-fence_kdump_send.patch
Patch28: %{name}-powerpc-no-reload-on-CPU-removal.patch
Patch29: %{name}-prefer-by-path-and-device-mapper.patch
Patch30: %{name}-calibrate-Update-values.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: gcc-c++
@ -137,6 +150,19 @@ after a crash dump has occured.
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%build
export CFLAGS="%{optflags}"