From 603224b256ed211c7102a2b70ff351638a3d9759 Mon Sep 17 00:00:00 2001 From: Baoquan He Date: Fri, 1 Mar 2013 15:14:19 +0800 Subject: [PATCH] Change dump_to_rootfs to be a default option and reboot to be default action Firstly rename dump_rootfs to dump_to_rootfs to remove the ambiguity about dump_rootfs. Then add it as one of default options. That means user can specify dump_to_rootfs to be default action manually, then it will take action when specified target dump failed. Secondly, in rhel7 and fedora, when default action is not specified, the default 'default' is dump_to_rootfs. Namely when specified target dump failed, the kdump initrd will mount root and save kdump from initramfs context. However in rhel6, the default 'default' is 'reboot'. That means when specified target dump failed, the kdump initrd will reboot systems. For being consistent with rhel6, change the default 'default' back to 'reboot'. And this can also keep logic simple, easier to understand. Primarily, Our default dump target is root filesystem. So keeping "default" as "dump_to_rootfs" and trying to dump to root filesystem again when first attempt fails does not make much sense. Meanwhile add the relevant description into kdump.conf,kdump.conf.5 and kexec-kdump-howto.txt. Signed-off-by: Baoquan He Acked-by: Dave Young Acked-by: Vivek Goyal --- dracut-kdump.sh | 9 ++++++--- kdump.conf | 10 +++++++--- kdump.conf.5 | 8 +++++--- kexec-kdump-howto.txt | 30 +++++++++++++++++++----------- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/dracut-kdump.sh b/dracut-kdump.sh index d46e728..38d0769 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -7,7 +7,7 @@ set -x KDUMP_PATH="/var/crash" CORE_COLLECTOR="" DEFAULT_CORE_COLLECTOR="makedumpfile -c --message-level 1 -d 31" -DEFAULT_ACTION="dump_rootfs" +DEFAULT_ACTION="reboot -f" DATEDIR=`date +%Y.%m.%d-%T` HOST_IP='127.0.0.1' DUMP_INSTRUCTION="" @@ -83,7 +83,7 @@ dump_raw() return 0 } -dump_rootfs() +dump_to_rootfs() { mount -o remount,rw $NEWROOT/ || return 1 mkdir -p $NEWROOT/$KDUMP_PATH/$HOST_IP-$DATEDIR @@ -182,6 +182,9 @@ read_kdump_conf() poweroff) DEFAULT_ACTION="poweroff -f" ;; + dump_to_rootfs) + DEFAULT_ACTION="dump_to_rootfs" + ;; esac ;; esac @@ -221,7 +224,7 @@ if [ $? -ne 0 ]; then fi if [ -z "$DUMP_INSTRUCTION" ]; then - add_dump_code "dump_rootfs" + add_dump_code "dump_to_rootfs" fi do_kdump_pre diff --git a/kdump.conf b/kdump.conf index 753af6b..fbed498 100644 --- a/kdump.conf +++ b/kdump.conf @@ -92,10 +92,10 @@ # modules can be listed, separated by a space, and any # dependent modules will automatically be included. # -# default +# default # - Action to preform in case dumping to intended target -# fails. If no default action is specified saving vmcore -# to root fs is assumed default. +# fails. If no default action is specified, "reboot" +# is assumed default. # reboot: If the default action is reboot simply reboot # the system and loose the core that you are # trying to retrieve. @@ -108,6 +108,10 @@ # where you can try to record the core manually. # Exiting this shell reboots the system. # Note: kdump uses bash as the default shell. +# dump_to_rootfs: If non-root dump target is specified, +# the default action can be set as dump_to_rootfs. +# That means when dump to target fails, dump vmcore +# to rootfs from initramfs context and reboot. # # force_rebuild <0 | 1> # - By default, kdump initrd only will be rebuilt when diff --git a/kdump.conf.5 b/kdump.conf.5 index c54de60..66b5e01 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -148,16 +148,18 @@ modules can be listed, separated by a space, and any dependent modules will automatically be included. .RE -.B default +.B default .RS Action to preform in case dumping to intended target fails. If no default -action is specified saving vmcore to root fs is assumed default. +action is specified, "reboot" is assumed default. reboot: If the default action is reboot simply reboot the system (this is what most people will want, as it returns the system to a nominal state). shell: If the default action is shell, then drop to an shell session inside the initramfs from where you can manually preform additional recovery actions. Exiting this shell reboots the system. halt: bring the system to a halt, requiring manual reset -poweroff: The system will be powered down. +poweroff: The system will be powered down. dump_to_rootfs:If the default action +is dump_to_rootfs, specified root will be mounted and dump will be saved in "path" +directory. Note: kdump uses bash as the default shell. .RE diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b45f35a..3023017 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -449,19 +449,27 @@ need to manually specify additional kernel modules to load into your kdump initrd. Default action +============== +Default action specifies what to do when dump to configured dump target +fails. By default, default action is "reboot" and that is system reboots +if attempt to save dump to dump target fails. -By default, if a configured dump method fails, the kdump initrd falls back -to trying to dump to the local file system (i.e., into the file system(s) -you would have mounted under normal system operation). The system always -reboots following an attempted dump to your local file system, regardless -of success or failure. +There are other default actions available though. -However, for any of the advanced methods, if the dump fails, you can configure -the kdump initrd to skip trying to dump to the local file system, instead -immediately rebooting ('default reboot'), halting the system ('default halt') -or dropping you to a shell within the initrd ('default shell'), from which you -could try to capture the vmcore manually. Again, if the 'default' parameter is -unset, a local file system dump will be attempted, then the system will reboot. +- dump_to_rootfs + This option tries to mount root and save dump on root filesystem + in a path specified by "path". This option will generally make + sense when dump target is not root filesystem. For example, if + dump is being saved over network using "ssh" then one can specify + default to "dump_to_rootfs" to try saving dump to root filesystem + if dump over network fails. + +- shell + Drop into a shell session inside initramfs. +- halt + Halt system after failure +- poweroff + Poweroff system after failure. Compression and filtering