[PATCH 1/2] pass mount info to dracut when default target is a separate disk
WANG Chao
chaowang at redhat.com
Thu Mar 13 03:37:49 UTC 2014
On 03/12/14 at 05:59pm, Baoquan He wrote:
> When user does not specify dump target explicitly, it's better to
> dump to the "path" specified. That means after dump user enter into
> 1st kernel, can find vmcore in the "path". If that path is in root
> fs, vmcore is stored in root fs. If separate disk is mounted on
> any tier of "path", we just dump vmcore into the left path on the
> left separate disk.
>
> E.g in kdump.conf
> path /mnt/nfs
>
> in mount info,
> /dev/vdb on /mnt type ext4 (rw,relatime,seclabel,data=ordered)
>
> Then vmcore will be saved in /nfs of /dev/vdb.
>
> In this patch, pass mount info to dracut in this case if separate
> disk is mounted on any tier of "path".
>
> Signed-off-by: Baoquan He <bhe at redhat.com>
> ---
> mkdumprd | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/mkdumprd b/mkdumprd
> index 241a426..d792b42 100644
> --- a/mkdumprd
> +++ b/mkdumprd
> @@ -355,12 +355,12 @@ get_block_dump_target()
> [ -b "$_target" ] && echo $(to_dev_name $_target)
> }
>
> -# If no dump disk is specified make sure /var/crash is not mounted on a
> -# separate disk.
> -check_block_dump_target()
> +#handle the case user does not specify the dump target explicitly
> +handle_default_dump_target()
> {
> local _target
> local _mntpoint
> + local _ret
>
> _target=$(get_user_configured_dump_disk)
> [ -n "$_target" ] && return
> @@ -368,11 +368,16 @@ check_block_dump_target()
> _target=$(get_root_fs_device)
> if [ -b "$_target" ]; then
> mkdir -p $SAVE_PATH
> - _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + perror_exit "mkdir failed on $SAVE_PATH"
> + fi
> + _mntpoint=$(df $SAVE_PATH | tail -1 | awk '{print $NF}')
How about using `findmnt -n -T $SAVE_PATH -o TARGET` instead of df ...
> if [ "$_mntpoint" != "/" ]; then
> - perror "No dump target specified. Default dump target is rootfs block device."
> - perror "But dump path $SAVE_PATH is not backed by rootfs block device. "
> - perror_exit "Either explicitly specify a dump target or specify a dump path backed by rootfs block device"
> + SAVE_PATH=$(echo $SAVE_PATH | sed "s,$_mntpoint,,")
How about using ${SAVE_PATH##$_mntpoint}
> + _target=$(findmnt -k -f -n -o SOURCE $_mntpoint)
> + add_mount "$_target"
> + check_size fs $_target
> fi
> fi
> }
> @@ -500,8 +505,6 @@ check_crypt()
> return 1
> }
>
> -check_block_dump_target
> -
> if ! check_resettable; then
> exit 1
> fi
> @@ -521,6 +524,8 @@ if [ "$(uname -m)" = "s390x" ]; then
> add_dracut_module "znet"
> fi
>
> +handle_default_dump_target
> +
> while read config_opt config_val;
> do
> # remove inline comments after the end of a directive.
> --
> 1.8.5.3
>
> _______________________________________________
> kexec mailing list
> kexec at lists.fedoraproject.org
> https://lists.fedoraproject.org/mailman/listinfo/kexec
More information about the kexec
mailing list