Fix the warning if the target path is bind mount in Atomic

kdump will raise the warning in Atomic, if the path is bind mounted
directory. The reason why causes this issue is kdump cannt parse the
bind mounted directory.

To correct dumping target, we can construct the real dumping path in
Atomic, which contains two part, one bind mounted path, the other
specified dump target.

Following is an example:
    -bash-4.2# cat /etc/kdump.conf | grep ^path
    path /var/crash

    -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]

    -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}'
    /dev/mapper/atomicos-root

Then we can found it that the real path of dumping vmcore is
/ostree/deploy/rhel-atomic-host/var/crash.

To fix this issue, we can replace the target path as the real path which
is from above parsing.

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:
Minfei Huang 2015-04-17 16:26:27 +08:00 committed by Baoquan He
parent c82a453c67
commit 7acaa304f6
2 changed files with 25 additions and 2 deletions

View File

@ -182,7 +182,10 @@ make_absolute_save_path()
local _mnt local _mnt
[ -n $_target ] && _mnt=$(get_mntpoint_from_target $1) [ -n $_target ] && _mnt=$(get_mntpoint_from_target $1)
echo "${_mnt}/$SAVE_PATH" _mnt="${_mnt}/$SAVE_PATH"
# strip the duplicated "/"
echo "$_mnt" | tr -s /
} }
check_save_path_fs() check_save_path_fs()

View File

@ -362,6 +362,17 @@ handle_default_dump_target()
_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 is_atomic && is_bind_mount $_mntpoint; then
SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
# the real dump path in the 2nd kernel, if the mount point is bind mounted.
SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH
_mntpoint=$(get_mntpoint_from_target $_target)
# the absolute path in the 1st kernel
SAVE_PATH=$_mntpoint/$SAVE_PATH
fi
if [ "$_mntpoint" != "/" ]; then if [ "$_mntpoint" != "/" ]; then
SAVE_PATH=${SAVE_PATH##"$_mntpoint"} SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
_fstype=$(get_fs_type_from_target $_target) _fstype=$(get_fs_type_from_target $_target)
@ -533,8 +544,17 @@ do
if [ "$config_opt" = "nfs" ]; then if [ "$config_opt" = "nfs" ]; then
add_dracut_module "nfs" add_dracut_module "nfs"
fi fi
_absolute_save_path=$(make_absolute_save_path $config_val)
_mntpoint=$(get_mntpoint_from_path $_absolute_save_path)
if is_atomic && is_bind_mount $_mntpoint; then
SAVE_PATH=${_absolute_save_path##"$_mntpoint"}
# the real dump path in the 2nd kernel, if the mount point is bind mounted.
SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH
fi
add_mount "$config_val" add_mount "$config_val"
check_save_path_fs $(make_absolute_save_path $config_val) check_save_path_fs $_absolute_save_path
check_size fs $config_val check_size fs $config_val
;; ;;
raw) raw)