kdumpctl: fix target identification for systems without initrd

We get following error on the systems that have everything built-in and no
initrd is used.

	Kernel dev name of /dev/root is not found.
	Dump target /dev/root is probably not mounted.

It happens because `df $path` gets /dev/root from /proc/self/mountinfo.

Fix this by identifying real target device when `df $path` returns
Filesystem as /dev/root.

Reported-and-tested-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Pratyush Anand <panand@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Pratyush Anand 2016-09-12 12:40:04 +05:30 committed by Dave Young
parent 1edfff7809
commit 4db9e59e89
2 changed files with 8 additions and 4 deletions

View File

@ -176,7 +176,11 @@ get_mntpoint_from_path()
get_target_from_path()
{
echo $(df $1 | tail -1 | awk '{print $1}')
local _target
_target=$(df $1 2>/dev/null | tail -1 | awk '{print $1}')
[[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device)
echo $_target
}
get_fs_type_from_target()

View File

@ -390,9 +390,9 @@ check_dump_fs_modified()
_new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d '"' -f 2)
else
_path=$(get_save_path)
set -- $(df -T $_path 2>/dev/null | tail -1 | awk '{ print $1, $2}')
_target=$(to_dev_name $1)
_new_fstype=$2
_target=$(get_target_from_path $_path)
_target=$(to_dev_name $_target)
_new_fstype=$(get_fs_type_from_target $_target)
if [[ -z "$_target" || -z "$_new_fstype" ]];then
echo "Dump path $_path does not exist"
return 2