kdump-lib.sh: Fix is_nfs_dump_target

Previously is_nfs_dump_target didn't cover the case that 'path <value>'
where <value> points to a nfs mount point. This function is never used
in first kernel before so so far it worked.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Kairui Song 2019-11-30 23:53:02 +08:00
parent 03111c797b
commit b76c567325

View File

@ -28,6 +28,11 @@ perror() {
echo $@ >&2
}
is_fs_type_nfs()
{
[ "$1" = "nfs" ] || [ "$1" = "nfs4" ]
}
is_ssh_dump_target()
{
grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
@ -35,8 +40,23 @@ is_ssh_dump_target()
is_nfs_dump_target()
{
grep -q "^nfs" /etc/kdump.conf || \
[[ $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") = nfs* ]]
if grep -q "^nfs" /etc/kdump.conf; then
return 0;
fi
if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then
return 0
fi
local _save_path=$(get_save_path)
local _target=$(get_target_from_path $_save_path)
local _fstype=$(get_fs_type_from_target $_target)
if is_fs_type_nfs $_fstype; then
return 0
fi
return 1
}
is_raw_dump_target()
@ -44,13 +64,6 @@ is_raw_dump_target()
grep -q "^raw" /etc/kdump.conf
}
is_fs_type_nfs()
{
local _fstype=$1
[ $_fstype = "nfs" ] || [ $_fstype = "nfs4" ] && return 0
return 1
}
is_fs_dump_target()
{
egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
@ -104,8 +117,7 @@ to_dev_name() {
is_user_configured_dump_target()
{
return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
grep -q "^ext[234]|^xfs|^btrfs|^minix|^raw|^nfs|^ssh" /etc/kdump.conf || is_mount_in_dracut_args;
}
get_user_configured_dump_disk()