On 04/10/15 at 04:18pm, Minfei Huang wrote:
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 "/".
Looks good to me, ack.
Acked-by: Baoquan He <bhe(a)redhat.com>
Thanks
Baoquan
To fix it, we will strip the duplicated "/" firstly.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
changelog:
v2
- change the subject to match the patch properly
v1:
- change the implementation using "tr" to strip the duplicated "/"
---
dracut-module-setup.sh | 11 ++++++-----
mkdumprd | 3 +++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4641025..540e154 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -311,15 +311,17 @@ kdump_install_net() {
default_dump_target_install_conf()
{
local _target _fstype
- local _s _t
local _mntpoint
- local _path _save_path
+ local _save_path
is_user_configured_dump_target && return
_save_path=$(get_option_value "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)
_target=$(get_target_from_path $_save_path)
if [ "$_mntpoint" != "/" ]; then
@@ -334,13 +336,12 @@ default_dump_target_install_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
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
- echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
+ echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
fi
-
}
#install kdump.conf and what user specifies in kdump.conf
diff --git a/mkdumprd b/mkdumprd
index 4d251ba..7c572a7 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,6 +13,9 @@ conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
+# strip the duplicated "/"
+SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+
extra_modules=""
dracut_args=("--hostonly" "-o" "plymouth dash resume")
OVERRIDE_RESETTABLE=0
--
1.9.3