File kdump-fadump-reboot.patch of Package kdump.2364

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Honour KDUMP_IMMEDIATE_REBOOT with FADUMP
References: bsc#917846
Patch-mainline: v0.8.16
Git-commit: 367d8a79b15373db4bab05f4b053c73cbfa2395c

When FADUMP is enabled, KDUMP_IMMEDIATE_REBOOT is ignored.
Note that this setting is often used for debugging, because a shell
is launched when rebooting is disabled. Introduce a new option
(KDUMP_FADUMP_SHELL) to enable the shell with fadump.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 doc/man/kdump.5.txt.in |   18 ++++++++++++++++++
 init/save_dump.sh      |   14 ++++++++++++++
 kdumptool/define_opt.h |    1 +
 sysconfig.kdump.in     |   12 ++++++++++++
 4 files changed, 45 insertions(+)

--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -201,6 +201,17 @@ boot, saves the dump, and continues with
 
 Default is "no".
 
+KDUMP_FADUMP_SHELL
+~~~~~~~~~~~~~~~~~~
+
+When this option is "yes", kdump launches a shell after saving the dump.
+If FADUMP is disabled, this option has no effect, because launching a shell
+is the default action when KDUMP_IMMEDIATE_REBOOT is set to "no".
+
+This option can be useful for debugging.
+
+Default is "no".
+
 endif::[]
 
 KEXEC_OPTIONS
@@ -227,6 +238,13 @@ KDUMP_IMMEDIATE_REBOOT
 
 Immediately reboot after saving the core in the kdump kernel? Use "yes" or "no".
 
+ifeval::['@HAVE_FADUMP@'=='TRUE']
+If this option is set to "no" and FADUMP is enabled, normal boot process
+continues after saving the dump. This can save one reboot, but on NUMA
+systems all node-level memory is allocated on the dumping node, degrading
+the performance of all other nodes until reboot.
+endif::[]
+
 Default is "yes".
 
 KDUMP_TRANSFER
--- a/init/save_dump.sh
+++ b/init/save_dump.sh
@@ -50,6 +50,20 @@ function handle_exit()
     if fadump_enabled; then
         # release memory if possible
         test -f $FADUMP_RELEASE_MEM && echo 1 > $FADUMP_RELEASE_MEM
+        if [ "$KDUMP_FADUMP_SHELL" = "yes" \
+                -o "$KDUMP_FADUMP_SHELL" = "YES" ] ; then
+            echo
+            echo "Dump saving completed."
+            echo "Type 'reboot -f' to reboot the system or 'exit' to"
+            echo "boot in a normal system."
+            bash
+        fi
+        if [ $KDUMP_IMMEDIATE_REBOOT = "yes" \
+                -o "$KDUMP_IMMEDIATE_REBOOT" = "YES" ] ; then
+            umount -a
+            reboot -f
+        fi
+
         # unmount kdump directories
         dirs=
         while read dev mp rest
--- a/kdumptool/define_opt.h
+++ b/kdumptool/define_opt.h
@@ -15,6 +15,7 @@ DEFINE_OPT(KDUMP_COMMANDLINE, String, ""
 DEFINE_OPT(KDUMP_COMMANDLINE_APPEND, String, "", KEXEC)
 #if HAVE_FADUMP
 DEFINE_OPT(KDUMP_FADUMP, Bool, false, MKINITRD)
+DEFINE_OPT(KDUMP_FADUMP_SHELL, Bool, false, MKINITRD | DUMP)
 #endif
 DEFINE_OPT(KEXEC_OPTIONS, String, "", KEXEC)
 DEFINE_OPT(MAKEDUMPFILE_OPTIONS, String, "", DUMP)
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -71,6 +71,18 @@ KDUMP_COMMANDLINE_APPEND=""
 #
 KDUMP_FADUMP="no"
 
+## Type:        yesno
+## Default:     "no"
+## ServiceRestart:	kdump
+#
+# If this option is set to yes, a shell is started after saving the dump
+# with fadump (see above).
+# This option can be useful for debugging.
+#
+# See also: kdump(5).
+#
+KDUMP_FADUMP_SHELL="no"
+
 @endif
 ## Type:	string
 ## Default:	""
openSUSE Build Service is sponsored by