kern/119868: [zfs] 7.0 kernel panic during boot with ZFS and
WD1600JS
Jaakko Heinonen
jh at saunalahti.fi
Thu Oct 2 07:50:03 UTC 2008
The following reply was made to PR kern/119868; it has been noted by GNATS.
From: Jaakko Heinonen <jh at saunalahti.fi>
To: Harald Hanche-Olsen <hanche at math.ntnu.no>
Cc: bug-followup at FreeBSD.org, johan at giantfoo.org, marcel at FreeBSD.org
Subject: Re: kern/119868: [zfs] 7.0 kernel panic during boot with ZFS and
WD1600JS
Date: Thu, 2 Oct 2008 10:39:52 +0300
Hi,
On 2008-09-30, Harald Hanche-Olsen wrote:
> For the curious: I intended to do
>
> #; gpt create -f da2
> #; gpt add -t 6a898cc3-1dd2-11b2-99a6-080020736631 da2
> #; zpool create poolname da2p1
>
> but apparently, I created the pool on da2 instead, partially
> overwriting the GPT.
This PR is a duplicate of kern/127115. The bug is not in zfs code but in
the gpart GPT code. It's possible that a corrupted GPT partition table
causes a panic in g_part_gpt_read().
These conditions must be true after reading the tables in
g_part_gpt_read() to cause the panic:
table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK
pritbl == NULL
table->state[GPT_ELT_SECTBL] == GPT_STATE_OK
The panic happens at line 661 in g_part_gpt.c (r183533) when tbl is NULL.
Here is a proposed fix:
%%%
Index: sys/geom/part/g_part_gpt.c
===================================================================
--- sys/geom/part/g_part_gpt.c (revision 183533)
+++ sys/geom/part/g_part_gpt.c (working copy)
@@ -631,7 +631,7 @@ g_part_gpt_read(struct g_part_table *bas
table->state[GPT_ELT_PRIHDR] = GPT_STATE_INVALID;
}
- if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) {
+ if (table->state[GPT_ELT_PRITBL] != GPT_STATE_OK) {
printf("GEOM: %s: the primary GPT table is corrupt or "
"invalid.\n", pp->name);
printf("GEOM: %s: using the secondary instead -- recovery "
@@ -641,7 +641,7 @@ g_part_gpt_read(struct g_part_table *bas
if (pritbl != NULL)
g_free(pritbl);
} else {
- if (table->state[GPT_ELT_SECHDR] != GPT_STATE_OK) {
+ if (table->state[GPT_ELT_SECTBL] != GPT_STATE_OK) {
printf("GEOM: %s: the secondary GPT table is corrupt "
"or invalid.\n", pp->name);
printf("GEOM: %s: using the primary only -- recovery "
%%%
The patch applied this is that I get with the corrupted GPT table:
GEOM: ad0: the primary GPT table is corrupt or invalid.
GEOM: ad0: using the secondary instead -- recovery strongly advised.
--
Jaakko
More information about the freebsd-bugs
mailing list