usr/src/uts/common/fs/zfs/spa_misc.c
changeset 2174 73de7a781492
parent 2082 76b439ec3ac1
child 2856 6f4d5ee1906a
--- a/usr/src/uts/common/fs/zfs/spa_misc.c	Mon Jun 12 07:52:21 2006 -0700
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c	Mon Jun 12 08:20:57 2006 -0700
@@ -837,7 +837,16 @@
 uint64_t
 spa_guid(spa_t *spa)
 {
-	return (spa->spa_root_vdev->vdev_guid);
+	/*
+	 * If we fail to parse the config during spa_load(), we can go through
+	 * the error path (which posts an ereport) and end up here with no root
+	 * vdev.  We stash the original pool guid in 'spa_load_guid' to handle
+	 * this case.
+	 */
+	if (spa->spa_root_vdev != NULL)
+		return (spa->spa_root_vdev->vdev_guid);
+	else
+		return (spa->spa_load_guid);
 }
 
 uint64_t