From owner-svn-src-all@freebsd.org Thu Jun 16 07:45:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD085A4731C; Thu, 16 Jun 2016 07:45:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76D3214C9; Thu, 16 Jun 2016 07:45:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5G7jvDe050453; Thu, 16 Jun 2016 07:45:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5G7jvag050452; Thu, 16 Jun 2016 07:45:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201606160745.u5G7jvag050452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 16 Jun 2016 07:45:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301955 - head/sys/boot/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2016 07:45:58 -0000 Author: avg Date: Thu Jun 16 07:45:57 2016 New Revision: 301955 URL: https://svnweb.freebsd.org/changeset/base/301955 Log: 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) Modified: head/sys/boot/zfs/zfs.c Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Thu Jun 16 06:34:12 2016 (r301954) +++ head/sys/boot/zfs/zfs.c Thu Jun 16 07:45:57 2016 (r301955) @@ -450,7 +450,7 @@ zfs_probe_partition(void *arg, const cha /* 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 cha 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 cha 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