On Mon, Mar 03, 2014 at 06:37:16PM +0800, Baoquan He wrote:
kdump now dumps vmcore to root partition by default in SAVE_PATCH
directory, e.g /var/crash defaultly. This is problematic when another
disk is mounted on /var or /var/crash, because the saved vmcore will
he hidden after dump in 1st kernel. This also has the potential of
blindly filling the root file system without a clue as to why.
Now fix this by failing the loading of kdump kernel if dump target
is root fs by default while different disk is mounted on save path.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index f7d2f4d..3ddf567 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -355,6 +355,27 @@ get_block_dump_target()
[ -b "$_target" ] && echo $(to_dev_name $_target)
}
Put a comment here. Something like.
# If no dump disk is specified make sure /var/crash is not mounted on a
# separate disk.
+check_block_dump_target()
+{
+ local _target
+ local _mntpoint
+
+ _target=$(get_user_configured_dump_disk)
+ [ -n "$_target" ] && echo $(to_dev_name $_target) &&
return
Why do we need to do "echo $(to_dev_name $_target)"? Shouldn't it just
be.
[ -n "$_target" ] && return
+
+ _target=$(get_root_fs_device)
+ if [ -b "$_target" ]; then
+ mkdir -p $SAVE_PATH
+ _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
What's the use of getting "_target" now? Looks like it is not being used?
Thanks
Vivek