aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorTom Caputi <[email protected]>2018-10-22 09:54:01 -0400
committerBrian Behlendorf <[email protected]>2018-10-24 14:37:35 -0700
commit7d658d29cf4b6b037156dfc29d298a7abb8afc86 (patch)
tree670668634cce16221dd5c40613184f33b7c2d711 /cmd
parent7ab96299e5b961c7d4c29344927f2c59e914545e (diff)
Fix waiting in ztest_device_removal()
spa->spa_vdev_removal is created in a sync task that is initiated via dsl_sync_task_nowait(). Since the task may not run before spa_vdev_remove() returns, we must wait at least 1 txg to ensure that the removal struct has been created. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Tom Caputi <[email protected]> Closes #8010
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ztest/ztest.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 983bc0dfe..14e8a5e27 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -3549,6 +3549,15 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id)
ztest_device_removal_active = B_TRUE;
mutex_exit(&ztest_vdev_lock);
+ /*
+ * spa->spa_vdev_removal is created in a sync task that
+ * is initiated via dsl_sync_task_nowait(). Since the
+ * task may not run before spa_vdev_remove() returns, we
+ * must wait at least 1 txg to ensure that the removal
+ * struct has been created.
+ */
+ txg_wait_synced(spa_get_dsl(spa), 0);
+
while (spa->spa_vdev_removal != NULL)
txg_wait_synced(spa_get_dsl(spa), 0);
} else {