diff options
author | Tom Caputi <[email protected]> | 2018-11-07 18:38:10 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-11-07 15:38:10 -0800 |
commit | ac53e50f799b39d9cd04e5ecc0a6552c9490c84a (patch) | |
tree | c427e7d429dedd9057bffb2646d0411d8b67a250 | |
parent | 4021ba4cfaa861602ae75d45713224d5a7866004 (diff) |
Fix vdev removal finishing race
This patch fixes a race condition where the end of
vdev_remove_replace_with_indirect(), which holds
svr_lock, would race against spa_vdev_removal_destroy(),
which destroys the same lock and is called asynchronously
via dsl_sync_task_nowait().
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Issue #6900
Closes #8083
-rw-r--r-- | module/zfs/vdev_removal.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 4e4a6c4f5..c259b5a1b 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -1115,19 +1115,16 @@ vdev_remove_replace_with_indirect(vdev_t *vd, uint64_t txg) ASSERT(!list_link_active(&vd->vdev_state_dirty_node)); - tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); - dsl_sync_task_nowait(spa->spa_dsl_pool, vdev_remove_complete_sync, svr, - 0, ZFS_SPACE_CHECK_NONE, tx); - dmu_tx_commit(tx); - - /* - * Indicate that this thread has exited. - * After this, we can not use svr. - */ mutex_enter(&svr->svr_lock); svr->svr_thread = NULL; cv_broadcast(&svr->svr_cv); mutex_exit(&svr->svr_lock); + + /* After this, we can not use svr. */ + tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); + dsl_sync_task_nowait(spa->spa_dsl_pool, vdev_remove_complete_sync, svr, + 0, ZFS_SPACE_CHECK_NONE, tx); + dmu_tx_commit(tx); } /* |