svn commit: r208443 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Martin Matuska mm at FreeBSD.org
Sun May 23 10:13:12 UTC 2010


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);
 
 			/*


More information about the svn-src-head mailing list