Add a is_mounted helper
Use is_mounted helper instaed of calling findmnt directly or checking if "mount" value is empty. If findmnt looks for fstab as well, some non mounted entry will also return value. Required to support non-mounted target. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
43ea36b3e8
commit
0624148414
@ -101,7 +101,7 @@ dump_fs()
|
|||||||
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
|
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
|
||||||
local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
|
local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
|
||||||
|
|
||||||
if [ -z "$_mp" ]; then
|
if ! is_mounted "$_mp"; then
|
||||||
_dev=$(findmnt -s -f -n -r -o SOURCE $1)
|
_dev=$(findmnt -s -f -n -r -o SOURCE $1)
|
||||||
_mp=$(findmnt -s -f -n -r -o TARGET $1)
|
_mp=$(findmnt -s -f -n -r -o TARGET $1)
|
||||||
_op=$(findmnt -s -f -n -r -o OPTIONS $1)
|
_op=$(findmnt -s -f -n -r -o OPTIONS $1)
|
||||||
|
@ -246,6 +246,11 @@ get_target_from_path()
|
|||||||
echo $_target
|
echo $_target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_mounted()
|
||||||
|
{
|
||||||
|
findmnt -k -n $1 &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
get_fs_type_from_target()
|
get_fs_type_from_target()
|
||||||
{
|
{
|
||||||
findmnt -k -f -n -r -o FSTYPE $1
|
findmnt -k -f -n -r -o FSTYPE $1
|
||||||
|
2
kdumpctl
2
kdumpctl
@ -475,7 +475,7 @@ check_dump_fs_modified()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! findmnt $_target >/dev/null; then
|
if ! is_mounted $_target; then
|
||||||
echo "Dump target $_target is probably not mounted."
|
echo "Dump target $_target is probably not mounted."
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
2
mkdumprd
2
mkdumprd
@ -366,7 +366,7 @@ do
|
|||||||
extra_modules="$extra_modules $config_val"
|
extra_modules="$extra_modules $config_val"
|
||||||
;;
|
;;
|
||||||
ext[234]|xfs|btrfs|minix|nfs)
|
ext[234]|xfs|btrfs|minix|nfs)
|
||||||
if ! findmnt $config_val >/dev/null; then
|
if ! is_mounted $config_val; then
|
||||||
perror_exit "Dump target $config_val is probably not mounted."
|
perror_exit "Dump target $config_val is probably not mounted."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user