Make grub_util_devmapper_part_to_disk and grub_util_find_partition_start
follow the same algorithm to avoid method mismatch. Don't assume DMRAID- UUID to mean full disk but instead check that mapping is linear.
This commit is contained in:
parent
da98622662
commit
e88f0420b9
6 changed files with 35 additions and 127 deletions
|
@ -288,6 +288,7 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
|
|||
{
|
||||
grub_util_fd_t fd;
|
||||
grub_disk_addr_t start;
|
||||
struct stat st;
|
||||
|
||||
sprintf (p, format, i);
|
||||
|
||||
|
@ -300,14 +301,16 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
|
|||
return 0;
|
||||
}
|
||||
missing = 0;
|
||||
close (fd);
|
||||
|
||||
if (!grub_util_device_is_mapped (real_dev)
|
||||
|| !grub_util_get_dm_node_linear_info (real_dev, 0, 0, &start))
|
||||
if (fstat (fd, &st) < 0
|
||||
|| !grub_util_device_is_mapped_stat (&st)
|
||||
|| !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0, &start))
|
||||
start = grub_util_find_partition_start_os (real_dev);
|
||||
/* We don't care about errors here. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
close (fd);
|
||||
|
||||
if (start == sector)
|
||||
{
|
||||
struct linux_partition_cache *new_cache_item;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue