summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/zfs/spa_misc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index e2d1ae3fc..dddbe9cfa 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -2582,8 +2582,18 @@ spa_set_missing_tvds(spa_t *spa, uint64_t missing)
const char *
spa_state_to_name(spa_t *spa)
{
- vdev_state_t state = spa->spa_root_vdev->vdev_state;
- vdev_aux_t aux = spa->spa_root_vdev->vdev_stat.vs_aux;
+ ASSERT3P(spa, !=, NULL);
+
+ /*
+ * it is possible for the spa to exist, without root vdev
+ * as the spa transitions during import/export
+ */
+ vdev_t *rvd = spa->spa_root_vdev;
+ if (rvd == NULL) {
+ return ("TRANSITIONING");
+ }
+ vdev_state_t state = rvd->vdev_state;
+ vdev_aux_t aux = rvd->vdev_stat.vs_aux;
if (spa_suspended(spa) &&
(spa_get_failmode(spa) != ZIO_FAILURE_MODE_CONTINUE))