From 0e3d6319a6cefa1bd81bd751ff6c24b3138cd833a3383aa956e08a231821c205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Wed, 21 Jun 2017 13:22:09 +0000 Subject: [PATCH] Accepting request 505037 from home:michals:SLE12-SP3 - 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) - kdump-remount-sysroot-readwrite.patch: Also remount writable any mounts that were already mounted readonly by systemd (bsc#1034169) - 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. OBS-URL: https://build.opensuse.org/request/show/505037 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=131 --- kdump-do-not-check-bind-mount.patch | 21 ++++++ ...y-when-immediate-reboot-is-requested.patch | 27 ++++++++ kdump-remount-sysroot-readwrite.patch | 65 +++++++++++++++++++ kdump-source-save_dump.patch | 21 ++++++ kdump.changes | 22 ++++++- kdump.spec | 8 +++ 6 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 kdump-do-not-check-bind-mount.patch create mode 100644 kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch create mode 100644 kdump-remount-sysroot-readwrite.patch create mode 100644 kdump-source-save_dump.patch diff --git a/kdump-do-not-check-bind-mount.patch b/kdump-do-not-check-bind-mount.patch new file mode 100644 index 0000000..35a2617 --- /dev/null +++ b/kdump-do-not-check-bind-mount.patch @@ -0,0 +1,21 @@ +Subject: Do not request filesystem check on bind mounts +References: bsc#1034169 + +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..34b7cdd --- /dev/null +++ b/kdump-do-not-free-fadump-memory-when-immediate-reboot-is-requested.patch @@ -0,0 +1,27 @@ +Subject: Do not free fadump memory when reboot is requested +References: bsc#1040610 + +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-remount-sysroot-readwrite.patch b/kdump-remount-sysroot-readwrite.patch new file mode 100644 index 0000000..b8095ba --- /dev/null +++ b/kdump-remount-sysroot-readwrite.patch @@ -0,0 +1,65 @@ +Subject: Remount /sysroot readwrite when used for kdump +References: bsc#1034169 + +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..f915cf8 --- /dev/null +++ b/kdump-source-save_dump.patch @@ -0,0 +1,21 @@ +Subject: Source save_dump.sh in systemd service. +References: bcs#1034169 + +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.changes b/kdump.changes index ff82ea5..dd606a1 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +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-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 +38,13 @@ 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. + ------------------------------------------------------------------- Wed May 17 13:31:11 UTC 2017 - ptesarik@suse.com @@ -154,7 +174,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..12bce80 100644 --- a/kdump.spec +++ b/kdump.spec @@ -55,6 +55,10 @@ 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 BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -128,6 +132,10 @@ cp %{S:1} tests/data/ %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 %build export CFLAGS="%{optflags}"