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(a)linux.vnet.ibm.com>
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
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