kdump-lib-initramfs: Improve mount point retrieval logic
Resolves: RHEL-35885 Upstream: https://github.com/rhkdump/kdump-utils/ Conflict: none commit 27a9d1dc85283239ee0b0b29ce5a00597d3f965f Author: Lichen Liu <lichliu@redhat.com> Date: Sun Sep 29 16:02:04 2024 +0800 kdump-lib-initramfs: Improve mount point retrieval logic We use findmnt to find the real mount point by mount source, however, when there is a bind mount target, findmnt will give more than one results and what we actually want is the one without fsroot. Will fallback to previous method if the $_mntpoint is empty. Signed-off-by: Lichen Liu <lichliu@redhat.com> Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
parent
71923b23d6
commit
4a3b7d1337
@ -102,8 +102,14 @@ get_fs_type_from_target()
|
|||||||
|
|
||||||
get_mntpoint_from_target()
|
get_mntpoint_from_target()
|
||||||
{
|
{
|
||||||
# --source is applied to ensure non-bind mount is returned
|
local _mntpoint
|
||||||
get_mount_info TARGET source "$1" -f
|
# 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()
|
is_ssh_dump_target()
|
||||||
|
@ -213,7 +213,7 @@ get_bind_mount_source()
|
|||||||
|
|
||||||
_fsroot=${_src#${_src_nofsroot}[}
|
_fsroot=${_src#${_src_nofsroot}[}
|
||||||
_fsroot=${_fsroot%]}
|
_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
|
# for btrfs, _fsroot will also contain the subvol value as well, strip it
|
||||||
if [[ $_fstype == btrfs ]]; then
|
if [[ $_fstype == btrfs ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user