Problem with zfsloader on 9.2-BETA2

J David j.david.lists at gmail.com
Wed Aug 7 18:59:30 UTC 2013


On Wed, Aug 7, 2013 at 4:08 AM, Andriy Gapon <avg at freebsd.org> wrote:
> Could you please hack gpt_checkhdr() in sys/boot/common/part.c to print all the
> relevant values for this check and try bootparttest again?

Your wish is my command:

--- common/part.c.orig	2013-08-05 19:00:49.536868414 +0000
+++ common/part.c	2013-08-07 18:34:09.277972724 +0000
@@ -184,7 +184,7 @@
 	if (hdr->hdr_entries < 128 ||
 	    hdr->hdr_entsz < sizeof(struct gpt_ent) ||
 	    sectorsize % hdr->hdr_entsz != 0) {
-		DEBUG("invalid entry size or number of entries");
+		DEBUG("invalid entry size (%u/%lu) or number of entries (%u)",
hdr->hdr_entsz, sizeof(struct gpt_ent), hdr->hdr_entries);
 		return (NULL);
 	}
 	hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start);

$ sudo ./bootparttest da2
GEOM provider "da2" opened
Mediasize: 1000204886016 Bytes (1953525168 sectors)
Sectorsize: 512 Bytes
da2: read 1 blocks from the offset 0 [+0]
da2: read 1 blocks from the offset 1 [+0]
ptable_open: PMBR detected
da2: read 1 blocks from the offset 1 [+0]
gpt_checkhdr: invalid entry size (128/128) or number of entries (9)
da2: read 1 blocks from the offset 1953525167 [+0]
gpt_checkhdr: invalid entry size (128/128) or number of entries (9)
Partition table detected: None

So it looks like this check is tripping because of hdr->hdr_entries (9 < 128).

If I change the minimum to 9 instead of 128, I get the following:

$ sudo ./bootparttest da2
GEOM provider "da2" opened
Mediasize: 1000204886016 Bytes (1953525168 sectors)
Sectorsize: 512 Bytes
da2: read 1 blocks from the offset 0 [+0]
da2: read 1 blocks from the offset 1 [+0]
ptable_open: PMBR detected
da2: read 1 blocks from the offset 1 [+0]
da2: read 2 blocks from the offset 2 [+0]
da2: read 1 blocks from the offset 1953525167 [+0]
ptable_gptread: new GPT partition added
Partition table detected: GPT
  da2p1: FreeBSD ZFS               931G

That looks like it's reading it.  So is "128 partitions is the
minimum" more of a guideline than an actual rule?  Maybe "be
restrictive with what you generate but permissive in what you accept"
would apply here.

Unfortunately since I am currently resilvering one of the drives with
a fresh gpart-built table, I won't be in a position to reboot this
machine for awhile to see if a zfsloader built with this change would
boot the pool.  But it seems like it might.

Thanks!


More information about the freebsd-stable mailing list