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 _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)
|
||||
_mp=$(findmnt -s -f -n -r -o TARGET $1)
|
||||
_op=$(findmnt -s -f -n -r -o OPTIONS $1)
|
||||
|
@ -246,6 +246,11 @@ get_target_from_path()
|
||||
echo $_target
|
||||
}
|
||||
|
||||
is_mounted()
|
||||
{
|
||||
findmnt -k -n $1 &>/dev/null
|
||||
}
|
||||
|
||||
get_fs_type_from_target()
|
||||
{
|
||||
findmnt -k -f -n -r -o FSTYPE $1
|
||||
|
2
kdumpctl
2
kdumpctl
@ -475,7 +475,7 @@ check_dump_fs_modified()
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! findmnt $_target >/dev/null; then
|
||||
if ! is_mounted $_target; then
|
||||
echo "Dump target $_target is probably not mounted."
|
||||
return 2
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user