[kexec-tools] kdump: Modify kdump script to stop firmware assisted dump

WANG Chao wangchao at fedoraproject.org
Mon Jul 28 05:06:09 UTC 2014


commit 9f7b8b03b4b1c51725f07eb7e02b9cf77cde0517
Author: Hari Bathini <hbathini at linux.vnet.ibm.com>
Date:   Fri Jul 25 00:09:00 2014 +0530

    kdump: Modify kdump script to stop firmware assisted dump
    
    During service kdump stop, if firmware assisted dump is enabled
    and running,  then stop firmware assisted dump by echo'ing 0 to
    '/sys/kernel/fadump_registered' file.
    
    Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
    Signed-off-by: Hari Bathini <hbathini at linux.vnet.ibm.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 kdumpctl |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/kdumpctl b/kdumpctl
index 199d2a9..0cfe2b9 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -736,18 +736,45 @@ start()
 	echo "Starting kdump: [OK]"
 }
 
-stop()
+stop_fadump()
+{
+	echo 0 > $FADUMP_REGISTER_SYS_NODE
+	if check_current_fadump_status; then
+		echo "fadump: failed to unregister"
+		return 1
+	fi
+
+	echo "fadump: unregistered successfully"
+	return 0
+}
+
+stop_kdump()
 {
 	$KEXEC -p -u 2>/dev/null
-	if [ $? == 0 ]; then
-		echo "kexec: unloaded kdump kernel"
-		echo "Stopping kdump: [OK]"
-		return 0
-	else
+	if [ $? != 0 ]; then
 		echo "kexec: failed to unload kdump kernel"
+		return 1
+	fi
+
+	echo "kexec: unloaded kdump kernel"
+	return 0
+}
+
+stop()
+{
+	if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+		stop_fadump
+	else
+		stop_kdump
+	fi
+
+	if [ $? != 0 ]; then
 		echo "Stopping kdump: [FAILED]"
 		return 1
 	fi
+
+	echo "Stopping kdump: [OK]"
+	return 0
 }
 
 if [ ! -f "$KDUMP_CONFIG_FILE" ]; then


More information about the scm-commits mailing list