From owner-freebsd-doc@freebsd.org Wed Mar 28 04:52:01 2018 Return-Path: Delivered-To: freebsd-doc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68D3BF5BAF0 for ; Wed, 28 Mar 2018 04:52:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02008750E7 for ; Wed, 28 Mar 2018 04:52:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 4782412817 for ; Wed, 28 Mar 2018 04:52:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w2S4q0Sr017949 for ; Wed, 28 Mar 2018 04:52:00 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w2S4q01n017948 for freebsd-doc@FreeBSD.org; Wed, 28 Mar 2018 04:52:00 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: freebsd-doc@FreeBSD.org Subject: [Bug 226714] zfsboot(8) erroneously suggests creating a BSD label Date: Wed, 28 Mar 2018 04:51:59 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Documentation X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: imp@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-doc@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 04:52:01 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226714 --- Comment #14 from Warner Losh --- (In reply to Eugene Grosbein from comment #12) So I'm not so sure that's the bug. The bug appears to be here: pa.fd =3D open(devname, O_RDONLY); if (pa.fd =3D=3D -1) return (0); ret =3D zfs_probe(pa.fd, ppa->pool_guid); if (ret =3D=3D 0) return (0); /* Do we have BSD label here? */ if (part->type =3D=3D PART_FREEBSD) { pa.devname =3D devname; pa.pool_guid =3D ppa->pool_guid; pa.secsz =3D ppa->secsz; table =3D ptable_open(&pa, part->end - part->start + 1, ppa->secsz, zfs_diskread); if (table !=3D NULL) { ptable_iterate(table, &pa, zfs_probe_partition); ptable_close(table); } } So if we can't open the s1 device (which we prohibit currently), then we return. If we can't open the device, we should just not probe zfs on the sl= ice, but we should probe it for the BSD partitions. That bug is easy enough to f= ix. The bug is here, not in libsa. It's behavior is working as designed. ptable_open should recurse properly though. It's kind of a moot distinction, though, because while we support non-zero offsets for the zpool partition, we can't really boot off such partitions because zfsboot assumes that the bootable zpool is in a partition that is at offset 0 (need not be the first one, it appears). The current instructions assume that zfsboot is installed in the ZFS boot zone, which also assumes t= hat the uber block is where it would be if the sliced started at location zero. I think the following fix is the right one, but I'm not sure yet: diff --git a/stand/zfs/zfs.c b/stand/zfs/zfs.c index 0050bbe0056..f51c5c1efaa 100644 --- a/stand/zfs/zfs.c +++ b/stand/zfs/zfs.c @@ -488,15 +488,19 @@ zfs_probe_partition(void *arg, const char *partname, return (0); ppa =3D (struct zfs_probe_args *)arg; - strncpy(devname, ppa->devname, strlen(ppa->devname) - 1); - devname[strlen(ppa->devname) - 1] =3D '\0'; - sprintf(devname, "%s%s:", devname, partname); + sprintf(devname, "%s%s:", ppa->devname, partname); pa.fd =3D open(devname, O_RDONLY); - if (pa.fd =3D=3D -1) - return (0); - ret =3D zfs_probe(pa.fd, ppa->pool_guid); - if (ret =3D=3D 0) - return (0); + if (pa.fd !=3D -1) { + /* + * Only probe the slice if there's no BSD label + * on it. When we have a nested scheme, we'll not + * be able to open the slice, but we will be able + * to open the ptable. + */ + ret =3D zfs_probe(pa.fd, ppa->pool_guid); + if (ret =3D=3D 0) + return (0); + } /* Do we have BSD label here? */ if (part->type =3D=3D PART_FREEBSD) { pa.devname =3D devname; Oh, and I agree we should stop telling people to create a BSD partition, bu= t we should support it because sometimes it's necessary for a swap or a dump partition. --=20 You are receiving this mail because: You are the assignee for the bug.=