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 <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Baoquan He 2013-03-01 15:14:19 +08:00
parent ff7d629a56
commit 603224b256
4 changed files with 37 additions and 20 deletions

View File

@ -7,7 +7,7 @@ set -x
KDUMP_PATH="/var/crash" KDUMP_PATH="/var/crash"
CORE_COLLECTOR="" CORE_COLLECTOR=""
DEFAULT_CORE_COLLECTOR="makedumpfile -c --message-level 1 -d 31" DEFAULT_CORE_COLLECTOR="makedumpfile -c --message-level 1 -d 31"
DEFAULT_ACTION="dump_rootfs" DEFAULT_ACTION="reboot -f"
DATEDIR=`date +%Y.%m.%d-%T` DATEDIR=`date +%Y.%m.%d-%T`
HOST_IP='127.0.0.1' HOST_IP='127.0.0.1'
DUMP_INSTRUCTION="" DUMP_INSTRUCTION=""
@ -83,7 +83,7 @@ dump_raw()
return 0 return 0
} }
dump_rootfs() dump_to_rootfs()
{ {
mount -o remount,rw $NEWROOT/ || return 1 mount -o remount,rw $NEWROOT/ || return 1
mkdir -p $NEWROOT/$KDUMP_PATH/$HOST_IP-$DATEDIR mkdir -p $NEWROOT/$KDUMP_PATH/$HOST_IP-$DATEDIR
@ -182,6 +182,9 @@ read_kdump_conf()
poweroff) poweroff)
DEFAULT_ACTION="poweroff -f" DEFAULT_ACTION="poweroff -f"
;; ;;
dump_to_rootfs)
DEFAULT_ACTION="dump_to_rootfs"
;;
esac esac
;; ;;
esac esac
@ -221,7 +224,7 @@ if [ $? -ne 0 ]; then
fi fi
if [ -z "$DUMP_INSTRUCTION" ]; then if [ -z "$DUMP_INSTRUCTION" ]; then
add_dump_code "dump_rootfs" add_dump_code "dump_to_rootfs"
fi fi
do_kdump_pre do_kdump_pre

View File

@ -92,10 +92,10 @@
# modules can be listed, separated by a space, and any # modules can be listed, separated by a space, and any
# dependent modules will automatically be included. # dependent modules will automatically be included.
# #
# default <reboot | halt | poweroff | shell> # default <reboot | halt | poweroff | shell | dump_to_rootfs>
# - Action to preform in case dumping to intended target # - Action to preform in case dumping to intended target
# fails. If no default action is specified saving vmcore # fails. If no default action is specified, "reboot"
# to root fs is assumed default. # is assumed default.
# reboot: If the default action is reboot simply reboot # reboot: If the default action is reboot simply reboot
# the system and loose the core that you are # the system and loose the core that you are
# trying to retrieve. # trying to retrieve.
@ -108,6 +108,10 @@
# where you can try to record the core manually. # where you can try to record the core manually.
# Exiting this shell reboots the system. # Exiting this shell reboots the system.
# Note: kdump uses bash as the default shell. # 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> # force_rebuild <0 | 1>
# - By default, kdump initrd only will be rebuilt when # - By default, kdump initrd only will be rebuilt when

View File

@ -148,16 +148,18 @@ modules can be listed, separated by a space, and any
dependent modules will automatically be included. dependent modules will automatically be included.
.RE .RE
.B default <reboot | halt | poweroff | shell> .B default <reboot | halt | poweroff | shell | dump_to_rootfs>
.RS .RS
Action to preform in case dumping to intended target fails. If no 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. action is specified, "reboot" is assumed default.
reboot: If the default action is reboot simply reboot the system (this is what 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 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 action is shell, then drop to an shell session inside the initramfs from
where you can manually preform additional recovery actions. Exiting this shell where you can manually preform additional recovery actions. Exiting this shell
reboots the system. halt: bring the system to a halt, requiring manual reset 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. Note: kdump uses bash as the default shell.
.RE .RE

View File

@ -449,19 +449,27 @@ need to manually specify additional kernel modules to load into your kdump
initrd. initrd.
Default action 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 There are other default actions available though.
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.
However, for any of the advanced methods, if the dump fails, you can configure - dump_to_rootfs
the kdump initrd to skip trying to dump to the local file system, instead This option tries to mount root and save dump on root filesystem
immediately rebooting ('default reboot'), halting the system ('default halt') in a path specified by "path". This option will generally make
or dropping you to a shell within the initrd ('default shell'), from which you sense when dump target is not root filesystem. For example, if
could try to capture the vmcore manually. Again, if the 'default' parameter is dump is being saved over network using "ssh" then one can specify
unset, a local file system dump will be attempted, then the system will reboot. 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 Compression and filtering