kdumpctl: remove "root=X" for kdump boot
Since the current dracut of Fedora already supports not always mounting root device, we can remove "root=X" from the command line directly, and always get the dump target specified in "/etc/kdump.conf" and mount it. If the dump target is located at root filesystem, we will add the root mount info explicitly from kdump side instead of from dracut side. For example, in case of nfs/ssh/usb/raw/etc(non-root) dumping, kdump will not mount the unnecessary root fs after this change. This patch removes "root=X" via the "KDUMP_COMMANDLINE_REMOVE" (if "default dump_to_rootfs" is specified, don't remove "root=X"), and mounts non-root target under "/kdumproot", the root target still under "/sysroot"(to be align with systemd sysroot.mount). After removing "root=X", we now add root fs mount information explicitly from the kdump side. Changed check_dump_fs_modified() a little to avoid rebuild when dump target is root, since we add root fs mount explicitly now. Signed-off-by: Xunlei Pang <xlpang@redhat.com> Acked-by: Pratyush Anand <panand@redhat.com> Acked-by:Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
bf5b3da107
commit
b40c1f96cf
@ -390,20 +390,20 @@ default_dump_target_install_conf()
|
||||
_save_path=$_mntpoint/$_save_path
|
||||
fi
|
||||
|
||||
_fstype=$(get_fs_type_from_target $_target)
|
||||
if is_fs_type_nfs $_fstype; then
|
||||
kdump_install_net "$_target"
|
||||
_fstype="nfs"
|
||||
else
|
||||
_target=$(kdump_get_persistent_dev $_target)
|
||||
fi
|
||||
|
||||
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
|
||||
|
||||
# strip the duplicated "/"
|
||||
_save_path=$(echo $_save_path | tr -s /)
|
||||
# don't touch the path under root mount
|
||||
if [ "$_mntpoint" != "/" ]; then
|
||||
_fstype=$(get_fs_type_from_target $_target)
|
||||
|
||||
if $(is_fs_type_nfs $_fstype); then
|
||||
kdump_install_net "$_target"
|
||||
_fstype="nfs"
|
||||
else
|
||||
_target=$(kdump_get_persistent_dev $_target)
|
||||
fi
|
||||
|
||||
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
|
||||
|
||||
# strip the duplicated "/"
|
||||
_save_path=$(echo $_save_path | tr -s /)
|
||||
_save_path=${_save_path##"$_mntpoint"}
|
||||
fi
|
||||
|
||||
|
31
kdumpctl
31
kdumpctl
@ -171,6 +171,11 @@ check_kdump_cpus()
|
||||
echo " try nr_cpus=$nr_min or larger instead"
|
||||
}
|
||||
|
||||
is_dump_to_rootfs()
|
||||
{
|
||||
grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
|
||||
}
|
||||
|
||||
# This function performs a series of edits on the command line.
|
||||
# Store the final result in global $KDUMP_COMMANDLINE.
|
||||
prepare_cmdline()
|
||||
@ -192,6 +197,17 @@ prepare_cmdline()
|
||||
# These params can be removed configurably
|
||||
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".
|
||||
#
|
||||
# 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="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
|
||||
|
||||
id=`get_bootcpu_initial_apicid`
|
||||
@ -512,11 +528,16 @@ check_dump_fs_modified()
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! findmnt $_target >/dev/null; then
|
||||
echo "Dump target $_target is probably not mounted."
|
||||
return 2
|
||||
fi
|
||||
_new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)"
|
||||
if ! findmnt $_target >/dev/null; then
|
||||
echo "Dump target $_target is probably not mounted."
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [[ "$_target" = "$(get_root_fs_device)" ]]; then
|
||||
_new_mntpoint="/sysroot"
|
||||
else
|
||||
_new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)"
|
||||
fi
|
||||
|
||||
_dracut_args=$(lsinitrd $TARGET_INITRD | grep "^Arguments:" | head -1)
|
||||
if [[ -z "$_dracut_args" ]];then
|
||||
|
29
mkdumprd
29
mkdumprd
@ -80,12 +80,6 @@ add_dracut_sshkey() {
|
||||
add_dracut_arg "--sshkey" "$1"
|
||||
}
|
||||
|
||||
target_is_root() {
|
||||
local _t
|
||||
_t=$(findmnt -k -n -r -o TARGET $1|sort|head -1)
|
||||
[ "$_t" = "/" ]
|
||||
}
|
||||
|
||||
# caller should ensure $1 is valid and mounted in 1st kernel
|
||||
to_mount() {
|
||||
local _dev=$1 _source _target _fstype _options _mntopts _pdev
|
||||
@ -247,13 +241,13 @@ verify_core_collector() {
|
||||
}
|
||||
|
||||
add_mount() {
|
||||
if ! target_is_root "$1"; then
|
||||
local _mnt=$(to_mount "$1")
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
add_dracut_mount "$_mnt"
|
||||
local _mnt=$(to_mount "$1")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
add_dracut_mount "$_mnt"
|
||||
}
|
||||
|
||||
get_block_dump_target()
|
||||
@ -274,7 +268,6 @@ handle_default_dump_target()
|
||||
{
|
||||
local _target
|
||||
local _mntpoint
|
||||
local _fstype
|
||||
|
||||
is_user_configured_dump_target && return
|
||||
|
||||
@ -293,13 +286,9 @@ handle_default_dump_target()
|
||||
SAVE_PATH=$_mntpoint/$SAVE_PATH
|
||||
fi
|
||||
|
||||
if [ "$_mntpoint" != "/" ]; then
|
||||
SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
|
||||
_fstype=$(get_fs_type_from_target $_target)
|
||||
|
||||
add_mount "$_target"
|
||||
check_size fs $_target
|
||||
fi
|
||||
SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
|
||||
add_mount "$_target"
|
||||
check_size fs $_target
|
||||
}
|
||||
|
||||
get_default_action_target()
|
||||
|
Loading…
Reference in New Issue
Block a user