From 9e30632a5b009e8a41730c4dfcc7b1a9cb9dce99 Mon Sep 17 00:00:00 2001 From: avg Date: Thu, 16 Jun 2016 07:45:57 +0000 Subject: fix a zfs boot regression introduced in r300117 by accident There is no reason to return non-zero value from zfs_probe_partition() as that causes following partitions to not be probed for ZFS vdevs. A particular scenario that I encountered is a GPT partitioned disk where several partitions have freebsd-zfs type. A partition with a lower index is used as a cache (l2arc) vdev and in that case case zfs_probe() returned a non-zero status. That status was returned to ptable_iterate() and caused it to abort the iteration. Because of that the subsequent partitions were not probed and a root pool was not discovered resulting in a boot failure. While there fix the style for nearby return statements. Approved by: re (kib) --- sys/boot/zfs/zfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/boot/zfs/zfs.c b/sys/boot/zfs/zfs.c index 700da78..229bcac 100644 --- a/sys/boot/zfs/zfs.c +++ b/sys/boot/zfs/zfs.c @@ -450,7 +450,7 @@ zfs_probe_partition(void *arg, const char *partname, /* Probe only freebsd-zfs and freebsd partitions */ if (part->type != PART_FREEBSD && part->type != PART_FREEBSD_ZFS) - return 0; + return (0); ppa = (struct zfs_probe_args *)arg; strncpy(devname, ppa->devname, strlen(ppa->devname) - 1); @@ -458,10 +458,10 @@ zfs_probe_partition(void *arg, const char *partname, sprintf(devname, "%s%s:", devname, partname); pa.fd = open(devname, O_RDONLY); if (pa.fd == -1) - return 0; + return (0); ret = zfs_probe(pa.fd, ppa->pool_guid); if (ret == 0) - return 0; + return (0); /* Do we have BSD label here? */ if (part->type == PART_FREEBSD) { pa.devname = devname; @@ -470,12 +470,12 @@ zfs_probe_partition(void *arg, const char *partname, table = ptable_open(&pa, part->end - part->start + 1, ppa->secsz, zfs_diskread); if (table != NULL) { - ret = ptable_iterate(table, &pa, zfs_probe_partition); + ptable_iterate(table, &pa, zfs_probe_partition); ptable_close(table); } } close(pa.fd); - return (ret); + return (0); } int -- cgit v1.1