loader: zfs reader should not probe partitionless disks (UEFI case)
With r342151 I did fix the BIOS version of zfs_probe_dev() from accessing the whole disk, but the fix was not complete - we actually did not check if the device name was really for whole disk. Since UEFI version is only calling the zfs_probe_dev() with partitions and not with whole disk, the UEFI loader was not able to find the zfs pools. This update does correct the issue by calling archsw.arch_getdev() to translate the device name back to dev_desc, and we have whole disk when both partition and slice values are -1. Reported by: alvisen_gmail.com Differential Revision: https://reviews.freebsd.org/D18558
This commit is contained in:
parent
ac4ff55dd9
commit
3e1a7746ae
@ -33,15 +33,16 @@ __FBSDID("$FreeBSD$");
|
||||
* Stand-alone file reading package.
|
||||
*/
|
||||
|
||||
#include <stand.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/queue.h>
|
||||
#include <disk.h>
|
||||
#include <part.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stand.h>
|
||||
#include <bootstrap.h>
|
||||
|
||||
#include "libzfs.h"
|
||||
@ -517,6 +518,7 @@ zfs_probe_partition(void *arg, const char *partname,
|
||||
int
|
||||
zfs_probe_dev(const char *devname, uint64_t *pool_guid)
|
||||
{
|
||||
struct disk_devdesc *dev;
|
||||
struct ptable *table;
|
||||
struct zfs_probe_args pa;
|
||||
uint64_t mediasz;
|
||||
@ -532,6 +534,17 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid)
|
||||
* disks and some systems will misreport the disk sizes and will
|
||||
* hang while accessing the disk.
|
||||
*/
|
||||
if (archsw.arch_getdev((void **)&dev, devname, NULL) == 0) {
|
||||
int partition = dev->d_partition;
|
||||
int slice = dev->d_slice;
|
||||
|
||||
free(dev);
|
||||
if (partition != -1 && slice != -1) {
|
||||
ret = zfs_probe(pa.fd, pool_guid);
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Probe each partition */
|
||||
ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz);
|
||||
|
Loading…
x
Reference in New Issue
Block a user