diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index b3e1aa7..2f73623 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -102,8 +102,14 @@ get_fs_type_from_target() get_mntpoint_from_target() { - # --source is applied to ensure non-bind mount is returned - get_mount_info TARGET source "$1" -f + local _mntpoint + # get the first TARGET when SOURCE doesn't end with ]. + # In most cases, a SOURCE ends with ] when fsroot or subvol exists. + _mntpoint=$(get_mount_info TARGET,SOURCE source "$1" | grep -v "\]$" | awk 'NR==1 { print $1 }') + + # fallback to the old way when _mntpoint is empty. + [[ -n "$_mntpoint" ]] || _mntpoint=$(get_mount_info TARGET source "$1" -f ) + echo $_mntpoint } is_ssh_dump_target() diff --git a/kdump-lib.sh b/kdump-lib.sh index 0ccabc0..28ee6c0 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -213,7 +213,7 @@ get_bind_mount_source() _fsroot=${_src#${_src_nofsroot}[} _fsroot=${_fsroot%]} - _mnt=$(get_mount_info TARGET source "$_src_nofsroot" -f) + _mnt=$(get_mntpoint_from_target "$_src_nofsroot") # for btrfs, _fsroot will also contain the subvol value as well, strip it if [[ $_fstype == btrfs ]]; then