Remove duplicate slash in save path
Now kdump cannt parse the path correctly, if the path contains duplicated "/". Following is an example to explain it detail. (the directory /mnt is a mount point which is mounted a block device) path //mnt/var/crash Then the warning will raise. Force rebuild /boot/initramfs-3.19.1kdump.img Rebuilding /boot/initramfs-3.19.1kdump.img df: ‘/mnt///mnt/var/crash’: No such file or directory /sbin/mkdumprd: line 239: [: -lt: unary operator expected kexec: loaded kdump kernel Starting kdump: [OK] For above case, kdump fails to check the fs size, due to the incorrect path. In kdump code flow, we will cut out the mount point(/mnt) from the path(//mnt/var/crash). But the mount point cannt match the path, because of the duplicated "/". To fix it, we will strip the duplicated "/" firstly. Signed-off-by: Minfei Huang <mhuang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Acked-by: Baoquan He <bhe@redhat.com>
This commit is contained in:
parent
2c443617bc
commit
fedeba5e4b
@ -311,15 +311,17 @@ kdump_install_net() {
|
|||||||
default_dump_target_install_conf()
|
default_dump_target_install_conf()
|
||||||
{
|
{
|
||||||
local _target _fstype
|
local _target _fstype
|
||||||
local _s _t
|
|
||||||
local _mntpoint
|
local _mntpoint
|
||||||
local _path _save_path
|
local _save_path
|
||||||
|
|
||||||
is_user_configured_dump_target && return
|
is_user_configured_dump_target && return
|
||||||
|
|
||||||
_save_path=$(get_option_value "path")
|
_save_path=$(get_option_value "path")
|
||||||
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
|
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
|
||||||
|
|
||||||
|
# strip the duplicated "/"
|
||||||
|
_save_path=$(echo $_save_path | tr -s /)
|
||||||
|
|
||||||
_mntpoint=$(get_mntpoint_from_path $_save_path)
|
_mntpoint=$(get_mntpoint_from_path $_save_path)
|
||||||
_target=$(get_target_from_path $_save_path)
|
_target=$(get_target_from_path $_save_path)
|
||||||
if [ "$_mntpoint" != "/" ]; then
|
if [ "$_mntpoint" != "/" ]; then
|
||||||
@ -334,13 +336,12 @@ default_dump_target_install_conf()
|
|||||||
|
|
||||||
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
|
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
|
||||||
|
|
||||||
_path=${_save_path##"$_mntpoint"}
|
_save_path=${_save_path##"$_mntpoint"}
|
||||||
|
|
||||||
#erase the old path line, then insert the parsed path
|
#erase the old path line, then insert the parsed path
|
||||||
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
|
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
|
||||||
echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
|
echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#install kdump.conf and what user specifies in kdump.conf
|
#install kdump.conf and what user specifies in kdump.conf
|
||||||
|
3
mkdumprd
3
mkdumprd
@ -13,6 +13,9 @@ conf_file="/etc/kdump.conf"
|
|||||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||||
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
|
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
|
||||||
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
|
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
|
||||||
|
# strip the duplicated "/"
|
||||||
|
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
|
||||||
|
|
||||||
extra_modules=""
|
extra_modules=""
|
||||||
dracut_args=("--hostonly" "-o" "plymouth dash resume")
|
dracut_args=("--hostonly" "-o" "plymouth dash resume")
|
||||||
OVERRIDE_RESETTABLE=0
|
OVERRIDE_RESETTABLE=0
|
||||||
|
Loading…
Reference in New Issue
Block a user