From 9f7b8b03b4b1c51725f07eb7e02b9cf77cde0517 Mon Sep 17 00:00:00 2001 From: Hari Bathini Date: Fri, 25 Jul 2014 00:09:00 +0530 Subject: [PATCH] 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 Signed-off-by: Hari Bathini Acked-by: Vivek Goyal --- kdumpctl | 39 +++++++++++++++++++++++++++++++++------ 1 file 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