Skip to content

Commit

Permalink
Fix waiting in ztest_device_removal()
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Tom Caputi <tcaputi@datto.com>

TEST_ZTEST_TIMEOUT=7200
  • Loading branch information
Tom Caputi committed Oct 22, 2018
1 parent 462cde0 commit 802f844
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3543,6 +3543,15 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id)
if (error == 0) {
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 {
Expand Down

0 comments on commit 802f844

Please sign in to comment.