File kdump-always-kexec_load-if-kexec_file_load-fails.patch of Package kdump.21349

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 23 Feb 2018 08:59:00 +0100
Subject: Try kexec_load(2) if kexec_file_load(2) fails for any reason
References: bsc#1080916
Upstream: merged
Git-commit: c9f231320fe6544b4e8aedd24a571105c4ff458a

Currently, kexec_load(2) is attempted only if kexec_file_load(2) is
unavailable. However, kexec_file_load(2) may also fail for other
reasons (e.g. missing kernel signature). It makes sense to try the
older syscall in that case.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 init/load.sh |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

--- a/init/load.sh
+++ b/init/load.sh
@@ -164,30 +164,24 @@ function load_kdump_kexec()
 
     output=$(eval "$KEXEC_CALL -s" 2>&1)
     result=$?
-    if [ $result -eq 255 ] ; then
-        echo $output | grep -q 'syscall kexec_file_load not available' && result=7
-    fi
 
     # print stderr in any case to show warnings that normally
     # would be supressed (bnc#374185)
-    echo -n "$output"; echo
+    echo "$output"
 
     if [ $result -eq 0 ] ; then
         kdump_logger "Loaded kdump kernel: $KEXEC_CALL -s, Result: $output"
         return 0
-    elif [ $result -ne 7 ]; then
-        kdump_logger "FAILED to load kdump kernel: $KEXEC_CALL -s, Result: $output"
-        return $result
     fi
 
-    # kexec_file_load(2) not available
-    kdump_echo "kexec_file_load(2) not available"
+    # kexec_file_load(2) failed
+    kdump_echo "kexec_file_load(2) failed"
     kdump_echo "Starting load kdump kernel with kexec_load(2)"
     kdump_echo "kexec cmdline: $KEXEC_CALL"
 
     output=$(eval "$KEXEC_CALL" 2>&1)
     result=$?
-    echo -n "$output";echo
+    echo "$output"
 
     if [ $result -eq 0 ] ; then
         kdump_logger "Loaded kdump kernel: $KEXEC_CALL, Result: $output"
openSUSE Build Service is sponsored by