changeset 8680:005fe27123ba

6786321 panic on spa_tryimport() a corrupted pool
author Lin Ling <Lin.Ling@Sun.COM>
date Mon, 02 Feb 2009 17:39:41 -0800
parents 9a9ef0969b61
children ec4ccb69025b
files usr/src/uts/common/fs/zfs/spa.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c	Mon Feb 02 16:25:54 2009 -0800
+++ b/usr/src/uts/common/fs/zfs/spa.c	Mon Feb 02 17:39:41 2009 -0800
@@ -2555,6 +2555,7 @@
 	char *poolname;
 	spa_t *spa;
 	uint64_t state;
+	int error;
 
 	if (nvlist_lookup_string(tryconfig, ZPOOL_CONFIG_POOL_NAME, &poolname))
 		return (NULL);
@@ -2574,7 +2575,7 @@
 	 * 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.
@@ -2593,7 +2594,7 @@
 		 * 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);
 
 			/*