Change dump_to_rootfs to use "--mount" instead of "root=X"

Currently, we kept "root=X" for the dump_to_rootfs case, this
patch consolidates to use "--mount" for all the kdump mounts.

One advantage of this way is that dracut can correctly mark root
(in case of dump_to_rootfs is specified) as the host device when
"--no-hostonly-default-device" is added in the following patch.

Changed the code style in passing, as shellcheck tool reported:
Use $(..) instead of deprecated `..`

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Xunlei Pang 2017-08-30 16:45:46 +08:00 committed by Dave Young
parent d5fe9022d0
commit 31dc60ad20
2 changed files with 13 additions and 10 deletions

View File

@ -181,32 +181,29 @@ prepare_cmdline()
local cmdline id
if [ -z "$KDUMP_COMMANDLINE" ]; then
cmdline=`cat /proc/cmdline`
cmdline=$(cat /proc/cmdline)
else
cmdline=${KDUMP_COMMANDLINE}
fi
# These params should always be removed
cmdline=`remove_cmdline_param "$cmdline" crashkernel panic_on_warn`
cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn)
# These params can be removed configurably
cmdline=`remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE}`
cmdline=$(remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE})
# Always remove "root=X", as we now explicitly generate all kinds
# of dump target mount information including root fs. But we can
# not remove it in case of fadump or "default dump_to_rootfs".
# of dump target mount information including root fs.
#
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
# about it(e.g. for debug purpose), then can pass "root=X" using
# KDUMP_COMMANDLINE_APPEND.
if [ $DEFAULT_DUMP_MODE != "fadump" ] && ! is_dump_to_rootfs; then
cmdline=`remove_cmdline_param "$cmdline" root`
fi
cmdline=$(remove_cmdline_param "$cmdline" root)
cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_apicid`
id=$(get_bootcpu_apicid)
if [ ! -z ${id} ] ; then
cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}`
cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id})
fi
KDUMP_COMMANDLINE=$cmdline

View File

@ -448,6 +448,12 @@ then
add_dracut_arg "--add-drivers" "$extra_modules"
fi
if ! is_fadump_capable; then
# The 2nd rootfs mount stays behind the normal dump target mount,
# so it doesn't affect the logic of check_dump_fs_modified().
is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))"
fi
dracut "${dracut_args[@]}" "$@"
_rc=$?
sync