Make get_mount_info work with bind mount
Remove the --real when calling findmnt. The option is only useful in capture kernel, to avoid `findmnt` returning the pseudo 'rootfs' for non mounted path. example, when /kdumproot/mnt/ is not mounted: kdump:/# findmnt --target /kdumproot/mnt TARGET SOURCE FSTYPE OPTIONS / rootfs rootfs rw,size=61368k,nr_inodes=15342 kdump:/# findmnt --target /kdumproot/mnt <return 1 and empty output> But this function will make findmnt also return empty value for bind mount. So remove it and add an extra if statement for second kernel. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
d551516f52
commit
08d9846eba
@ -123,7 +123,7 @@ dump_fs()
|
|||||||
ddebug "_mp=$_mp _dev=$_dev _op=$_op"
|
ddebug "_mp=$_mp _dev=$_dev _op=$_op"
|
||||||
|
|
||||||
# If dump path have a corresponding device entry but not mounted, mount it.
|
# If dump path have a corresponding device entry but not mounted, mount it.
|
||||||
if [ -n "$_dev" ]; then
|
if [ -n "$_dev" ] && [ "$_dev" != "rootfs" ]; then
|
||||||
if ! is_mounted "$_mp"; then
|
if ! is_mounted "$_mp"; then
|
||||||
dinfo "dump target $_dev is not mounted, trying to mount..."
|
dinfo "dump target $_dev is not mounted, trying to mount..."
|
||||||
mkdir -p $_mp
|
mkdir -p $_mp
|
||||||
|
@ -256,9 +256,9 @@ is_mounted()
|
|||||||
get_mount_info()
|
get_mount_info()
|
||||||
{
|
{
|
||||||
local _info_type=$1 _src_type=$2 _src=$3; shift 3
|
local _info_type=$1 _src_type=$2 _src=$3; shift 3
|
||||||
local _info=$(findmnt --real -k -n -r -o $_info_type --$_src_type $_src $@)
|
local _info=$(findmnt -k -n -r -o $_info_type --$_src_type $_src $@)
|
||||||
|
|
||||||
[ -z "$_info" ] && [ -e "/etc/fstab" ] && _info=$(findmnt --real -s -n -r -o $_info_type --$_src_type $_src $@)
|
[ -z "$_info" ] && [ -e "/etc/fstab" ] && _info=$(findmnt -s -n -r -o $_info_type --$_src_type $_src $@)
|
||||||
|
|
||||||
echo $_info
|
echo $_info
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user