From nobody@FreeBSD.org  Mon Feb 22 20:42:20 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B59E106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Feb 2010 20:42:20 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id EF6088FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Feb 2010 20:42:19 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MKgJTt002762
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Feb 2010 20:42:19 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o1MKgJFO002761;
	Mon, 22 Feb 2010 20:42:19 GMT
	(envelope-from nobody)
Message-Id: <201002222042.o1MKgJFO002761@www.freebsd.org>
Date: Mon, 22 Feb 2010 20:42:19 GMT
From: Volodymyr Kostyrko <c.kworr@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: zfsboot fails on gang block after upgrade to zfs v14
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144214
>Category:       bin
>Synopsis:       zfsboot fails on gang block after upgrade to zfs v14
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    avg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 22 20:50:01 UTC 2010
>Closed-Date:    Mon Jun 07 14:04:15 UTC 2010
>Last-Modified:  Mon Jun 07 14:04:15 UTC 2010
>Originator:     Volodymyr Kostyrko
>Release:        RELENG_8
>Organization:
>Environment:
FreeBSD limbo.lan 8.0-STABLE FreeBSD 8.0-STABLE #0: Sun Feb 21 13:49:54 EET 2010     arcade@limbo.lan:/usr/obj/usr/src/sys/MINIMAL_8  i386
>Description:
The bug is hard to get. Everything should match:

 * i386 arch,
 * `make installkernel`,
 * RELENG_8 after zfs v14 import,
 * zpool with zfs v14,
 * zfsboot installed.

Boot partition is NOT compressed, changing the boot partition does nothing, even creating a new one.

After that sometimes part of kernel or other modules would yield "ZFS: gang block detected" on loading.
>How-To-Repeat:
Any installkernel can do the trick.
>Fix:
Bootability can be restored with:

rsync -lrptygoWSH --delete /boot /somewhere/boot
rm -rf /boot
rsync -lrptygoWSH --delete /somewhere/boot /boot

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-fs 
Responsible-Changed-By: remko 
Responsible-Changed-When: Wed Feb 24 06:48:26 UTC 2010 
Responsible-Changed-Why:  
Reassign to fs team 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144214 

From: "Andrei V. Lavreniyuk" <andy.lavr@reactor-xg.kiev.ua>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Wed, 24 Feb 2010 10:29:48 +0200

 Hi!
 
 
 Fix:
 
 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad0
 
 
 
 
 
 -- 
   Best regards, Andrei V. Lavreniyuk.
 

From: Volodymyr Kostyrko <c.kworr@gmail.com>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Fri, 26 Feb 2010 00:33:23 +0200

 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
 gpart: No such geom: ada0
 
 Could you explain what exactly it should do? Using gptzfsboot instead of 
 simple zfsboot?
 
 -- 
 Sphinx of black quartz judge my vow.

From: "Andrei V. Lavreniyuk" <andy.lavr@reactor-xg.kiev.ua>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Fri, 26 Feb 2010 11:42:11 +0200

 Hi!
 
 
 http://wiki.freebsd.org/ZFS
 
 http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/
 
 
 
 -- 
   Best regards, Andrei V. Lavreniyuk.
 

From: =?KOI8-R?Q?=F7=CF=CC=CF=C4=C9=CD=C9=D2_=EB=CF=D3=D4=C9=D2=CB=CF?=
 <c.kworr@gmail.com>
To: andy.lavr@reactor-xg.kiev.ua
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Fri, 26 Feb 2010 11:56:19 +0200

 26.02.2010 11:42, Andrei V. Lavreniyuk wrote:
 > http://wiki.freebsd.org/ZFS
 >
 > http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/
 
 This is not my case. I have no partitions at all and I'm booting from a 
 ZFS dedicated disk. And if I'm not missing something gpart requires 
 separate partition with gptzfsboot to work.
 
 -- 
 Sphinx of black quartz judge my vow.

From: Dan Naumov <dan.naumov@gmail.com>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: RE: bin/144214: zfsboot fails on gang block after upgrade to zfs v14
Date: Sat, 27 Feb 2010 01:57:16 +0200

 > I have no partitions at all and I'm booting from a ZFS dedicated disk.
 
 Sure you do have partitions. Booting off a purely ZFS disk without a
 valid partition table is not and has never been possible in neither
 FreeBSD nor Solaris.
 
 What you need to do is update your bootcode (because it has changed
 for zfs v14). How you do this depends on whether you use zfsboot or
 gptzfsboot. The links above describe the process.
 
 
 - Sincerely,
 Dan Naumov

From: Martin Matuska <mm@FreeBSD.org>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 29 Apr 2010 02:16:24 +0200

 This bug is still actual.
 We had to forcibly reboot a server with a 97% full zpool (~2GB free space)
 and we came to a ZFS: gang block detected
 The workaround with re-creating and re-populating /boot worked.

From: Daniel Gerzo <danger@FreeBSD.org>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 29 Apr 2010 02:11:16 +0200

 Hello,
 
 this bug seems to be still present in stable/8. The proposed workaround 
 seems to work. You may find the console screenshot at
 http://danger.rulez.sk/dockdrop/144214.png
 
 -- 
 S pozdravom / Best regards
    Daniel Gerzo, FreeBSD committer

From: =?windows-1252?Q?Daniel_Ger=9Eo?= <danger@rulez.sk>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 29 Apr 2010 02:13:42 +0200

 Hi,
 
 note that the HDD has been almost full (97%) when the box died (ca. 2GB 
 free).
 
 -- 
 S pozdravom / Best regards
    Daniel Gerzo

From: Andriy Gapon <avg@icyb.net.ua>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 29 Apr 2010 15:10:28 +0300

 Just to be on the sure side: have you guys actually updated bootblocks on your system?
 I.e. the code that runs before loader and that resides beyond filesystems.
 
 -- 
 Andriy Gapon

From: Andriy Gapon <avg@icyb.net.ua>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 13 May 2010 08:59:28 +0300

 I had a private conversation with Daniel Gerzo (danger@) and neither him nor mm@
 are sure that the system for which they reported the problem had the latest boot
 blocks that are supposed to actually support zfs gang blocks.
 
 P.S. gang block support seems to have been added to stable/8 by rnoland@ on 21
 Nov 2009 in r199634, so anything before that is not expected to work.
 
 -- 
 Andriy Gapon

From: Andriy Gapon <avg@icyb.net.ua>
To: bug-followup@FreeBSD.org, c.kworr@gmail.com
Cc: Robert Noland <rnoland@FreeBSD.org>
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 13 May 2010 09:59:00 +0300

 This is a multi-part message in MIME format.
 --------------010603020208000201000600
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 7bit
 
 
 It seems that I have been misunderstanding the problem.
 "ZFS: gang block detected" won't even appear if boot code is too old.
 
 Having briefly glanced over the code and comparing it to the code in osol and in
 zio_gang_tree_issue(), I think the following change is needed.
 But I am not sure if it is a real fix for the issue at hand.
 
 If anyone can reproduce the problem, could you please test this change?
 Thanks!
 
 -- 
 Andriy Gapon
 
 --------------010603020208000201000600
 Content-Type: text/plain;
  name="zfs-boot-gang.patch"
 Content-Transfer-Encoding: base64
 Content-Disposition: inline;
  filename="zfs-boot-gang.patch"
 
 ZGlmZiAtLWdpdCBhL3N5cy9ib290L3pmcy96ZnNpbXBsLmMgYi9zeXMvYm9vdC96ZnMvemZz
 aW1wbC5jCmluZGV4IGRjMjllMGUuLmVhZTAwMjMgMTAwNjQ0Ci0tLSBhL3N5cy9ib290L3pm
 cy96ZnNpbXBsLmMKKysrIGIvc3lzL2Jvb3QvemZzL3pmc2ltcGwuYwpAQCAtOTYyLDggKzk2
 MiwxMyBAQCB6aW9fcmVhZF9nYW5nKHNwYV90ICpzcGEsIGNvbnN0IGJsa3B0cl90ICpicCwg
 Y29uc3QgZHZhX3QgKmR2YSwgdm9pZCAqYnVmKQogCQlyZXR1cm4gKEVJTyk7CiAKIAlmb3Ig
 KGkgPSAwOyBpIDwgU1BBX0dCSF9OQkxLUFRSUzsgaSsrKSB7Ci0JCWlmICh6aW9fcmVhZChz
 cGEsICZ6aW9fZ2IuemdfYmxrcHRyW2ldLCBidWYpKQorCQlibGtwdHJfdCAqZ2JwID0gJnpp
 b19nYi56Z19ibGtwdHJbaV07CisKKwkJaWYgKEJQX0lTX0hPTEUoZ2JwKSkKKwkJCWNvbnRp
 bnVlOworCQlpZiAoemlvX3JlYWQoc3BhLCBnYnAsIGJ1ZikpCiAJCQlyZXR1cm4gKEVJTyk7
 CisJCWJ1ZiA9IChjaGFyKilidWYgKyBCUF9HRVRfUFNJWkUoZ2JwKTsKIAl9CiAgCiAJcmV0
 dXJuICgwKTsK
 --------------010603020208000201000600--

From: Robert Noland <rnoland@FreeBSD.org>
To: Andriy Gapon <avg@icyb.net.ua>
Cc: bug-followup@FreeBSD.org, c.kworr@gmail.com
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 13 May 2010 08:52:14 -0500

 Andriy Gapon wrote:
 > It seems that I have been misunderstanding the problem.
 > "ZFS: gang block detected" won't even appear if boot code is too old.
 > 
 > Having briefly glanced over the code and comparing it to the code in osol and in
 > zio_gang_tree_issue(), I think the following change is needed.
 > But I am not sure if it is a real fix for the issue at hand.
 > 
 > If anyone can reproduce the problem, could you please test this change?
 > Thanks!
 
 This looks sane.  I was never actually able to test it, since 
 reproducing the issue is rather tricky.
 
 robert.
 
 > 

From: Volodymyr Kostyrko <c.kworr@gmail.com>
To: Andriy Gapon <avg@icyb.net.ua>
Cc: bug-followup <bug-followup@freebsd.org>, Robert Noland <rnoland@freebsd.org>
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs v14
Date: Fri, 14 May 2010 17:12:23 +0300

 2010/5/13 Andriy Gapon <avg@icyb.net.ua>:
 >
 > It seems that I have been misunderstanding the problem.
 > "ZFS: gang block detected" won't even appear if boot code is too old.
 >
 > Having briefly glanced over the code and comparing it to the code in osol and in
 > zio_gang_tree_issue(), I think the following change is needed.
 > But I am not sure if it is a real fix for the issue at hand.
 >
 > If anyone can reproduce the problem, could you please test this change?
 > Thanks!
 
 Tested it. Same problem.
 
 1. Rebuild and reinstall on i386. Filling disk up (600M free of 120G, 0.5%).
 2. Immediately after starting boot screen bursts into psychic colors.
 Computer reboots.
 3. Booted from ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/201004/FreeBSD-8.0-STABLE-201004-i386-livefs.iso
 in VirtualBox i386. Boot code updated with dd.
 4. Same as p2. in vBox i386 takes looong time to rotate dash then
 spits "ZFS: gang block detected" and hangs.
 5. Booted from amd64 install, updated boot code with dd.
 6. Booted on amd64. Immediately after starting boot spits out "ZFS:
 gang block detected" and hangs.
 7. Booted from amd64 install. /boot transferred transferred to/from other disk.
 8. Booted on amd64. Immediately after starting boot spits out "ZFS:
 gang block detected" and hangs.
 9. Booted from amd64 install. Some files deleted (800M free, files
 were written contiguously). /boot transferred transferred to/from
 other disk.
 10. Booted on amd64.
 
 Results:
 1. Patch changes something. However zfsloader(?) still can't be read completely.
 2. Bug can happen on amd64. More extreme conditions needed(?).
 3. I'll post a follow-up on successfully booting on original i386 hardware.
 
 -- 
 Sphinx of black quartz judge my vow.

From: Andriy Gapon <avg@icyb.net.ua>
To: Volodymyr Kostyrko <c.kworr@gmail.com>
Cc: bug-followup <bug-followup@freebsd.org>,
        Robert Noland <rnoland@freebsd.org>
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Fri, 14 May 2010 21:15:31 +0300

 on 14/05/2010 17:12 Volodymyr Kostyrko said the following:
 > 2010/5/13 Andriy Gapon <avg@icyb.net.ua>:
 >> It seems that I have been misunderstanding the problem.
 >> "ZFS: gang block detected" won't even appear if boot code is too old.
 >>
 >> Having briefly glanced over the code and comparing it to the code in osol and in
 >> zio_gang_tree_issue(), I think the following change is needed.
 >> But I am not sure if it is a real fix for the issue at hand.
 >>
 >> If anyone can reproduce the problem, could you please test this change?
 >> Thanks!
 > 
 > Tested it. Same problem.
 
 Sigh.  I almost do not see any other obvious differences with other code that is
 supposed to support gang blocks.
 
 > 1. Rebuild and reinstall on i386. Filling disk up (600M free of 120G, 0.5%).
 > 2. Immediately after starting boot screen bursts into psychic colors.
 > Computer reboots.
 
 With unpatched boot code I presume?
 
 > 3. Booted from ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/201004/FreeBSD-8.0-STABLE-201004-i386-livefs.iso
 > in VirtualBox i386. Boot code updated with dd.
 
 Have you updated both both part of zfsboot and loader?
 Are you sure that you used patched versions? (asking just in case)
 
 > 4. Same as p2. in vBox i386 takes looong time to rotate dash then
 > spits "ZFS: gang block detected" and hangs.
 
 Nothing else get printed?
 Asking because of this screenshot:
 http://danger.rulez.sk/dockdrop/144214.png
 
 > 5. Booted from amd64 install, updated boot code with dd.
 > 6. Booted on amd64. Immediately after starting boot spits out "ZFS:
 > gang block detected" and hangs.
 > 7. Booted from amd64 install. /boot transferred transferred to/from other disk.
 > 8. Booted on amd64. Immediately after starting boot spits out "ZFS:
 > gang block detected" and hangs.
 
 amd64 has exactly the same boot code that i386 has, perhaps some difference
 could arise during compilation, but even if so, it should not matter much in our
 case.
 
 > 9. Booted from amd64 install. Some files deleted (800M free, files
 > were written contiguously). /boot transferred transferred to/from
 > other disk.
 > 10. Booted on amd64.
 
 Not interested much in the workarounds - if they work, then OK, but mainly we
 are trying to fix the boot code.  Only behavior of installed zfsboot and
 zfsloader are interesting to us.
 
 > Results:
 > 1. Patch changes something. However zfsloader(?) still can't be read completely.
 > 2. Bug can happen on amd64. More extreme conditions needed(?).
 > 3. I'll post a follow-up on successfully booting on original i386 hardware.
 
 Can you please also share output of 'zfs get all' for the boot filesystem?
 Thank you for your help!
 
 And one last thing that I could think of:
 --- a/sys/boot/zfs/zfsimpl.c
 +++ b/sys/boot/zfs/zfsimpl.c
 @@ -1001,7 +1001,7 @@ zio_read(spa_t *spa, const blkptr_t *bp, void *buf)
  		if (DVA_GET_GANG(dva)) {
  			printf("ZFS: gang block detected!\n");
  			if (zio_read_gang(spa, bp, dva, buf))
 -				return (EIO);
 +				continue;
  		} else {
  			vdevid = DVA_GET_VDEV(dva);
  			offset = DVA_GET_OFFSET(dva);
 
 This should be applied in addition to the previous patch.
 If this still doesn't work, the it would make sense to add printfs in various
 places of zio_read_gang() function to try to see what happens there.
 
 -- 
 Andriy Gapon

From: Andriy Gapon <avg@freebsd.org>
To: bug-followup@freebsd.org, c.kworr@gmail.com
Cc:  
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs
 v14
Date: Thu, 27 May 2010 02:02:03 +0300

 This is a multi-part message in MIME format.
 --------------070503050708060501010606
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 7bit
 
 
 Here's a new patch that, as I strongly believe, should fix the problem for real.
 I am sending "production ready" version of the patch, please keep "ZFS: gang
 block detected!" message in your sources during testing/verification.
 
 Thanks!
 -- 
 Andriy Gapon
 
 --------------070503050708060501010606
 Content-Type: text/plain;
  name="gang.diff"
 Content-Transfer-Encoding: base64
 Content-Disposition: inline;
  filename="gang.diff"
 
 ZGlmZiAtLWdpdCBhL3N5cy9ib290L3pmcy96ZnNpbXBsLmMgYi9zeXMvYm9vdC96ZnMvemZz
 aW1wbC5jCmluZGV4IDE0MDdlYjUuLjY0MDFjNmIgMTAwNjQ0Ci0tLSBhL3N5cy9ib290L3pm
 cy96ZnNpbXBsLmMKKysrIGIvc3lzL2Jvb3QvemZzL3pmc2ltcGwuYwpAQCAtOTU4LDEyICs5
 NjksMTcgQEAgemlvX3JlYWRfZ2FuZyhzcGFfdCAqc3BhLCBjb25zdCBibGtwdHJfdCAqYnAs
 IGNvbnN0IGR2YV90ICpkdmEsIHZvaWQgKmJ1ZikKIAkJCWJyZWFrOwogCWlmICghdmRldiB8
 fCAhdmRldi0+dl9yZWFkKQogCQlyZXR1cm4gKEVJTyk7Ci0JaWYgKHZkZXYtPnZfcmVhZCh2
 ZGV2LCBicCwgJnppb19nYiwgb2Zmc2V0LCBTUEFfR0FOR0JMT0NLU0laRSkpCisJaWYgKHZk
 ZXYtPnZfcmVhZCh2ZGV2LCBOVUxMLCAmemlvX2diLCBvZmZzZXQsIFNQQV9HQU5HQkxPQ0tT
 SVpFKSkKIAkJcmV0dXJuIChFSU8pOwogCiAJZm9yIChpID0gMDsgaSA8IFNQQV9HQkhfTkJM
 S1BUUlM7IGkrKykgewotCQlpZiAoemlvX3JlYWQoc3BhLCAmemlvX2diLnpnX2Jsa3B0cltp
 XSwgYnVmKSkKKwkJYmxrcHRyX3QgKmdicCA9ICZ6aW9fZ2IuemdfYmxrcHRyW2ldOworCisJ
 CWlmIChCUF9JU19IT0xFKGdicCkpCisJCQljb250aW51ZTsKKwkJaWYgKHppb19yZWFkKHNw
 YSwgZ2JwLCBidWYpKQogCQkJcmV0dXJuIChFSU8pOworCQlidWYgPSAoY2hhciopYnVmICsg
 QlBfR0VUX1BTSVpFKGdicCk7CiAJfQogIAogCXJldHVybiAoMCk7CkBAIC05OTQsOSArMTAx
 MCw4IEBAIHppb19yZWFkKHNwYV90ICpzcGEsIGNvbnN0IGJsa3B0cl90ICpicCwgdm9pZCAq
 YnVmKQogCQkJY29udGludWU7CiAKIAkJaWYgKERWQV9HRVRfR0FORyhkdmEpKSB7Ci0JCQlw
 cmludGYoIlpGUzogZ2FuZyBibG9jayBkZXRlY3RlZCFcbiIpOwogCQkJaWYgKHppb19yZWFk
 X2dhbmcoc3BhLCBicCwgZHZhLCBidWYpKQotCQkJCXJldHVybiAoRUlPKTsgCisJCQkJY29u
 dGludWU7CiAJCX0gZWxzZSB7CiAJCQl2ZGV2aWQgPSBEVkFfR0VUX1ZERVYoZHZhKTsKIAkJ
 CW9mZnNldCA9IERWQV9HRVRfT0ZGU0VUKGR2YSk7Cg==
 --------------070503050708060501010606--
State-Changed-From-To: open->analyzed 
State-Changed-By: avg 
State-Changed-When: Fri May 28 06:53:51 UTC 2010 
State-Changed-Why:  
It seems that I've got interested and involved in this PR. 


Responsible-Changed-From-To: freebsd-fs->avg 
Responsible-Changed-By: avg 
Responsible-Changed-When: Fri May 28 06:53:51 UTC 2010 
Responsible-Changed-Why:  
It seems that I've got interested and involved in this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144214 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144214: commit references a PR
Date: Fri, 28 May 2010 07:34:31 +0000 (UTC)

 Author: avg
 Date: Fri May 28 07:34:20 2010
 New Revision: 208610
 URL: http://svn.freebsd.org/changeset/base/208610
 
 Log:
   boot/zfs: fix gang block reading code
   
   - use correct size (512) while reading a gang block
   - skip holes while reading child blocks
   - advance buffer pointer while reading child blocks
   
   PR:		144214
   MFC after:	10 days
 
 Modified:
   head/sys/boot/zfs/zfsimpl.c
 
 Modified: head/sys/boot/zfs/zfsimpl.c
 ==============================================================================
 --- head/sys/boot/zfs/zfsimpl.c	Fri May 28 06:49:57 2010	(r208609)
 +++ head/sys/boot/zfs/zfsimpl.c	Fri May 28 07:34:20 2010	(r208610)
 @@ -958,12 +958,17 @@ zio_read_gang(spa_t *spa, const blkptr_t
  			break;
  	if (!vdev || !vdev->v_read)
  		return (EIO);
 -	if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE))
 +	if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE))
  		return (EIO);
  
  	for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
 -		if (zio_read(spa, &zio_gb.zg_blkptr[i], buf))
 +		blkptr_t *gbp = &zio_gb.zg_blkptr[i];
 +
 +		if (BP_IS_HOLE(gbp))
 +			continue;
 +		if (zio_read(spa, gbp, buf))
  			return (EIO);
 +		buf = (char*)buf + BP_GET_PSIZE(gbp);
  	}
   
  	return (0);
 @@ -994,9 +999,8 @@ zio_read(spa_t *spa, const blkptr_t *bp,
  			continue;
  
  		if (DVA_GET_GANG(dva)) {
 -			printf("ZFS: gang block detected!\n");
  			if (zio_read_gang(spa, bp, dva, buf))
 -				return (EIO); 
 +				continue;
  		} else {
  			vdevid = DVA_GET_VDEV(dva);
  			offset = DVA_GET_OFFSET(dva);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: analyzed->patched 
State-Changed-By: avg 
State-Changed-When: Fri May 28 07:44:31 UTC 2010 
State-Changed-Why:  
The fix is committed to head. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144214 

From: Volodymyr Kostyrko <c.kworr@gmail.com>
To: Andriy Gapon <avg@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: bin/144214: zfsboot fails on gang block after upgrade to zfs v14
Date: Fri, 28 May 2010 21:29:52 +0000

 2010/5/26 Andriy Gapon <avg@freebsd.org>:
 > Here's a new patch that, as I strongly believe, should fix the problem for real.
 > I am sending "production ready" version of the patch, please keep "ZFS: gang
 > block detected!" message in your sources during testing/verification.
 
 Yes, this patch works. After reinitializing boot code the message
 "ZFS: gang block detected!" appears multiple times but system proceeds
 with the boot sequence.
 
 -- 
 Sphinx of black quartz judge my vow.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144214: commit references a PR
Date: Mon,  7 Jun 2010 13:37:32 +0000 (UTC)

 Author: avg
 Date: Mon Jun  7 13:37:13 2010
 New Revision: 208892
 URL: http://svn.freebsd.org/changeset/base/208892
 
 Log:
   MFC r208610: boot/zfs: fix gang block reading code
   
   - use correct size (512) while reading a gang block
   - skip holes while reading child blocks
   - advance buffer pointer while reading child blocks
   
   PR:		144214
   Approved by:	re(kib)
 
 Modified:
   stable/8/sys/boot/zfs/zfsimpl.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
   stable/8/sys/geom/sched/   (props changed)
 
 Modified: stable/8/sys/boot/zfs/zfsimpl.c
 ==============================================================================
 --- stable/8/sys/boot/zfs/zfsimpl.c	Mon Jun  7 11:33:20 2010	(r208891)
 +++ stable/8/sys/boot/zfs/zfsimpl.c	Mon Jun  7 13:37:13 2010	(r208892)
 @@ -958,12 +958,17 @@ zio_read_gang(spa_t *spa, const blkptr_t
  			break;
  	if (!vdev || !vdev->v_read)
  		return (EIO);
 -	if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE))
 +	if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE))
  		return (EIO);
  
  	for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
 -		if (zio_read(spa, &zio_gb.zg_blkptr[i], buf))
 +		blkptr_t *gbp = &zio_gb.zg_blkptr[i];
 +
 +		if (BP_IS_HOLE(gbp))
 +			continue;
 +		if (zio_read(spa, gbp, buf))
  			return (EIO);
 +		buf = (char*)buf + BP_GET_PSIZE(gbp);
  	}
   
  	return (0);
 @@ -994,9 +999,8 @@ zio_read(spa_t *spa, const blkptr_t *bp,
  			continue;
  
  		if (DVA_GET_GANG(dva)) {
 -			printf("ZFS: gang block detected!\n");
  			if (zio_read_gang(spa, bp, dva, buf))
 -				return (EIO); 
 +				continue;
  		} else {
  			vdevid = DVA_GET_VDEV(dva);
  			offset = DVA_GET_OFFSET(dva);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144214: commit references a PR
Date: Mon,  7 Jun 2010 13:44:13 +0000 (UTC)

 Author: avg
 Date: Mon Jun  7 13:44:04 2010
 New Revision: 208893
 URL: http://svn.freebsd.org/changeset/base/208893
 
 Log:
   MFC r208610: boot/zfs: fix gang block reading code
   
   - use correct size (512) while reading a gang block
   - skip holes while reading child blocks
   - advance buffer pointer while reading child blocks
   
   PR:		144214
 
 Modified:
   stable/7/sys/boot/zfs/zfsimpl.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/boot/zfs/zfsimpl.c
 ==============================================================================
 --- stable/7/sys/boot/zfs/zfsimpl.c	Mon Jun  7 13:37:13 2010	(r208892)
 +++ stable/7/sys/boot/zfs/zfsimpl.c	Mon Jun  7 13:44:04 2010	(r208893)
 @@ -914,12 +914,17 @@ zio_read_gang(spa_t *spa, const blkptr_t
  			break;
  	if (!vdev || !vdev->v_read)
  		return (EIO);
 -	if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE))
 +	if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE))
  		return (EIO);
  
  	for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
 -		if (zio_read(spa, &zio_gb.zg_blkptr[i], buf))
 +		blkptr_t *gbp = &zio_gb.zg_blkptr[i];
 +
 +		if (BP_IS_HOLE(gbp))
 +			continue;
 +		if (zio_read(spa, gbp, buf))
  			return (EIO);
 +		buf = (char*)buf + BP_GET_PSIZE(gbp);
  	}
   
  	return (0);
 @@ -950,9 +955,8 @@ zio_read(spa_t *spa, const blkptr_t *bp,
  			continue;
  
  		if (DVA_GET_GANG(dva)) {
 -			printf("ZFS: gang block detected!\n");
  			if (zio_read_gang(spa, bp, dva, buf))
 -				return (EIO); 
 +				continue;
  		} else {
  			vdevid = DVA_GET_VDEV(dva);
  			offset = DVA_GET_OFFSET(dva);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: avg 
State-Changed-When: Mon Jun 7 14:03:31 UTC 2010 
State-Changed-Why:  
Should be resolved now in all stable branches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144214 
>Unformatted:
