summaryrefslogtreecommitdiffstats
path: root/module/zfs/spa_misc.c
diff options
context:
space:
mode:
authorGeorge Wilson <[email protected]>2012-12-14 12:38:04 -0800
committerBrian Behlendorf <[email protected]>2013-01-08 10:35:42 -0800
commit3bc7e0fb0f3904eaf41e0b9768ebe2d042ae98aa (patch)
treea72896a0cabe59d930c2253078eca4877b5dbb27 /module/zfs/spa_misc.c
parent5ac0c30a94a0804080f0a89c9b7a31f8d4ab5708 (diff)
Illumos #3090 and #3102
3090 vdev_reopen() during reguid causes vdev to be treated as corrupt 3102 vdev_uberblock_load() and vdev_validate() may read the wrong label Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Approved by: Eric Schrock <[email protected]> References: illumos/illumos-gate@dfbb943217bf8ab22a1a9d2e9dca01d4da95ee0b illumos changeset: 13777:b1e53580146d https://www.illumos.org/issues/3090 https://www.illumos.org/issues/3102 Ported-by: Brian Behlendorf <[email protected]> Closes #939
Diffstat (limited to 'module/zfs/spa_misc.c')
-rw-r--r--module/zfs/spa_misc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 440a6addb..5ec8e688e 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -1334,16 +1334,29 @@ spa_name(spa_t *spa)
uint64_t
spa_guid(spa_t *spa)
{
+ dsl_pool_t *dp = spa_get_dsl(spa);
+ uint64_t 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_config_guid' to handle
* this case.
*/
- if (spa->spa_root_vdev != NULL)
+ if (spa->spa_root_vdev == NULL)
+ return (spa->spa_config_guid);
+
+ guid = spa->spa_last_synced_guid != 0 ?
+ spa->spa_last_synced_guid : spa->spa_root_vdev->vdev_guid;
+
+ /*
+ * Return the most recently synced out guid unless we're
+ * in syncing context.
+ */
+ if (dp && dsl_pool_sync_context(dp))
return (spa->spa_root_vdev->vdev_guid);
else
- return (spa->spa_config_guid);
+ return (guid);
}
uint64_t