kdump now defaults to only dump vmcore to the root partition in the
/var/crash directory. This is problematic when /var is a separate
file system because this makes saved vmcore hidden since one can
not unmount /var even in single user mode. This also has the potential
of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action
is dump_to_rootfs while different disk is mounted on save path.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kexec-kdump-howto.txt | 3 +++
mkdumprd | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 7ffeab9..a43c225 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -430,6 +430,9 @@ There are other default actions available though.
- poweroff
Poweroff system after failure.
+Note that if default action is set to dump_to_rootfs, kdump will fail
+loading of kdump kernel when a different disk is mounted on 'save path'.
+
Compression and filtering
The 'core_collector' parameter in kdump.conf allows you to specify a custom
diff --git a/mkdumprd b/mkdumprd
index bc002bc..a86f8bb 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -370,6 +370,24 @@ get_default_action_target()
return
}
+check_default_action_target()
+{
+ local _target
+ local _mntpoint
+ local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}')
+ if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then
+ #get rootfs device name
+ mkdir -p $SAVE_PATH
+ _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
+ if [ "$_mntpoint" != "/" ]; then
+ perror_exit "$_target is mounted on $_mntpoint"
+ fi
+ fi
+ return
+}
+
+
get_override_resettable()
{
local override_resettable
@@ -453,6 +471,8 @@ check_resettable()
return 1
}
+check_default_action_target
+
if ! check_resettable; then
exit 1
fi
--
1.8.3.1