Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 May 2010 10:13:11 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208443 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201005231013.o4NADBVE044632@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Sun May 23 10:13:11 2010
New Revision: 208443
URL: http://svn.freebsd.org/changeset/base/208443

Log:
  Fix kernel panic when calling spa_tryimport() on a corrupted pool.
  
  OpenSolaris onnv revision:	8680:005fe27123ba
  
  Approved by:	delphij (mentor)
  Obtained from:	OpenSolaris (Bug ID 6786321)
  MFC after:	1 day

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Sun May 23 10:08:05 2010	(r208442)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Sun May 23 10:13:11 2010	(r208443)
@@ -2478,6 +2478,7 @@ spa_tryimport(nvlist_t *tryconfig)
 	char *poolname;
 	spa_t *spa;
 	uint64_t state;
+	int error;
 
 	if (nvlist_lookup_string(tryconfig, ZPOOL_CONFIG_POOL_NAME, &poolname))
 		return (NULL);
@@ -2497,7 +2498,7 @@ spa_tryimport(nvlist_t *tryconfig)
 	 * Pass TRUE for mosconfig because the user-supplied config
 	 * is actually the one to trust when doing an import.
 	 */
-	(void) spa_load(spa, tryconfig, SPA_LOAD_TRYIMPORT, B_TRUE);
+	error = spa_load(spa, tryconfig, SPA_LOAD_TRYIMPORT, B_TRUE);
 
 	/*
 	 * If 'tryconfig' was at least parsable, return the current config.
@@ -2516,7 +2517,7 @@ spa_tryimport(nvlist_t *tryconfig)
 		 * copy it out so that external consumers can tell which
 		 * pools are bootable.
 		 */
-		if (spa->spa_bootfs) {
+		if ((!error || error == EEXIST) && spa->spa_bootfs) {
 			char *tmpname = kmem_alloc(MAXPATHLEN, KM_SLEEP);
 
 			/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005231013.o4NADBVE044632>