From nobody@FreeBSD.org  Tue Dec  9 23:06:41 2008
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 17152106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  9 Dec 2008 23:06:41 +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 040E98FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  9 Dec 2008 23:06:41 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9N6eQE094979
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 9 Dec 2008 23:06:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id mB9N6eqX094978;
	Tue, 9 Dec 2008 23:06:40 GMT
	(envelope-from nobody)
Message-Id: <200812092306.mB9N6eqX094978@www.freebsd.org>
Date: Tue, 9 Dec 2008 23:06:40 GMT
From: Paul Wootton <paul@fletchermoorland.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ZFS Boot from single drive or mirror with raidz data pack
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         129539
>Category:       misc
>Synopsis:       ZFS Boot from single drive or mirror with raidz data pack
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 09 23:10:01 UTC 2008
>Closed-Date:    Wed Dec 10 10:50:15 UTC 2008
>Last-Modified:  Wed Dec 10 10:50:15 UTC 2008
>Originator:     Paul Wootton
>Release:        FreeBSD 8.0
>Organization:
>Environment:
FreeBSD wasp.caspersworld.co.uk 8.0-CURRENT FreeBSD 8.0-CURRENT #1: Sat Dec  6 22:49:23 UTC 2008     paul@wasp.caspersworld.co.uk:/usr/obj/usr/src/sys/WASP  amd64

>Description:
When booting from a single ZFS disk or mirror pack with a raidz pack also present, the system just cyclic boots with the following error

ZFS: can only boot from disk or mirror vdevs
ZFS: inconsistent nvlist contents

This is caused because we forgot to check the return code of vdev_init_from_nvlist(vdevs, &top_vdev) from with the vdev_probe() function in /usr/src/sys/boot/zfs/zfsimple.c on line 726
>How-To-Repeat:
Set up bootable ZFS single drive or mirror pack and then introduce a raidz pack as well
>Fix:
Check the return code of vdev_init_from_nvlist(vdevs, &top_vdev) from with the vdev_probe() function in /usr/src/sys/boot/zfs/zfsimple.c on line 726

Patch attached with submission follows:

*** zfsimpl.c	Wed Nov 19 16:59:19 2008
--- zfsimpl.c.fix	Tue Dec  9 22:48:36 2008
***************
*** 721,731 ****
  	if (nvlist_find(nvlist,
  			ZPOOL_CONFIG_VDEV_TREE,
  			DATA_TYPE_NVLIST, 0, &vdevs)) {
  		return (EIO);
  	}
! 	vdev_init_from_nvlist(vdevs, &top_vdev);
  
  	/*
  	 * Add the toplevel vdev to the pool if its not already there.
  	 */
  	STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink)
--- 721,733 ----
  	if (nvlist_find(nvlist,
  			ZPOOL_CONFIG_VDEV_TREE,
  			DATA_TYPE_NVLIST, 0, &vdevs)) {
  		return (EIO);
  	}
! 	int initRetVal = vdev_init_from_nvlist(vdevs, &top_vdev);
! 	if(initRetVal)
! 		return initRetVal;
  
  	/*
  	 * Add the toplevel vdev to the pool if its not already there.
  	 */
  	STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink)


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dfr 
State-Changed-When: Wed Dec 10 10:49:20 UTC 2008 
State-Changed-Why:  
Patch applied (with slight style changes) in subversion revision 185852. 

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