Fix zpool resilver stalls with spa_scrub_thread in a 3 way deadlock

OpenSolaris onnv-revision:	9997:174d75a29a1c

Obtained from:	OpenSolaris (Bug ID 6843235)
Approved by:	pjd, delphij (mentor)
MFC after:	3 days
This commit is contained in:
Martin Matuska 2010-06-12 11:24:10 +00:00
parent 072b6fc60e
commit 16547ea20b

View File

@ -1008,6 +1008,8 @@ dsl_pool_scrub_clean_cb(dsl_pool_t *dp,
int
dsl_pool_scrub_clean(dsl_pool_t *dp)
{
spa_t *spa = dp->dp_spa;
/*
* Purge all vdev caches. We do this here rather than in sync
* context because this requires a writer lock on the spa_config
@ -1015,11 +1017,11 @@ dsl_pool_scrub_clean(dsl_pool_t *dp)
* spa_scrub_reopen flag indicates that vdev_open() should not
* attempt to start another scrub.
*/
spa_config_enter(dp->dp_spa, SCL_ALL, FTAG, RW_WRITER);
dp->dp_spa->spa_scrub_reopen = B_TRUE;
vdev_reopen(dp->dp_spa->spa_root_vdev);
dp->dp_spa->spa_scrub_reopen = B_FALSE;
spa_config_exit(dp->dp_spa, SCL_ALL, FTAG);
spa_vdev_state_enter(spa);
spa->spa_scrub_reopen = B_TRUE;
vdev_reopen(spa->spa_root_vdev);
spa->spa_scrub_reopen = B_FALSE;
(void) spa_vdev_state_exit(spa, NULL, 0);
return (dsl_pool_scrub_setup(dp, SCRUB_FUNC_CLEAN));
}