diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-04 11:08:03 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2019-01-04 11:08:47 -0500 |
commit | 781f142d2ae880bb893875d2a114552171a5c3e5 (patch) | |
tree | 623d1aa58d36b17e7a5e5fdc6a92f2dc81b8ff89 | |
parent | 8a06b3d6467c15646e663c05086378f16288af85 (diff) | |
download | illumos-joyent-781f142d2ae880bb893875d2a114552171a5c3e5.tar.gz |
10064 loader: zfs reader should not probe partitionless disks
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/zfs/zfs.c | 24 |
2 files changed, 20 insertions, 6 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index f7de1f0e03..4683eed3f4 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2018.12.11.1 +BOOT_VERSION = $(LOADER_VERSION)-2018.12.18.1 diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c index 1f68b012b2..471fd6b32f 100644 --- a/usr/src/boot/sys/boot/zfs/zfs.c +++ b/usr/src/boot/sys/boot/zfs/zfs.c @@ -30,15 +30,16 @@ * 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 <inttypes.h> @@ -521,6 +522,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; @@ -531,10 +533,22 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid) pa.fd = open(devname, O_RDONLY); if (pa.fd == -1) return (ENXIO); - /* Probe the whole disk */ - ret = zfs_probe(pa.fd, pool_guid); - if (ret == 0) - return (0); + /* + * We will not probe the whole disk, we can not boot from such + * 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); |