summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2019-02-27 10:49:22 -0800
committerGitHub <[email protected]>2019-02-27 10:49:22 -0800
commit6af7ba417eb429413f9f24cd2704a302d766d9b4 (patch)
tree57b1584702c63f2e1bb13a785339eed22fa756d5 /module/zfs
parentc568ab8d99d88b69f54159cd771cb9b20784174e (diff)
Fix overly broad spa config lock
The spa_txg_history_init_io() and spa_txg_history_fini_io() were mistakenly taking SCL_ALL when only SCL_CONFIG is required to access the vdev stats. This could result in a deadlock which was observed when running ztest. Reviewed-by: Olaf Faaland <[email protected]> Reviewed-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #8445
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/spa_stats.c8
-rw-r--r--module/zfs/vdev.c1
2 files changed, 4 insertions, 5 deletions
diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
index c02ef86b5..e01d2d198 100644
--- a/module/zfs/spa_stats.c
+++ b/module/zfs/spa_stats.c
@@ -414,9 +414,9 @@ spa_txg_history_init_io(spa_t *spa, uint64_t txg, dsl_pool_t *dp)
ts = kmem_alloc(sizeof (txg_stat_t), KM_SLEEP);
- spa_config_enter(spa, SCL_ALL, FTAG, RW_READER);
+ spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
vdev_get_stats(spa->spa_root_vdev, &ts->vs1);
- spa_config_exit(spa, SCL_ALL, FTAG);
+ spa_config_exit(spa, SCL_CONFIG, FTAG);
ts->txg = txg;
ts->ndirty = dp->dp_dirty_pertxg[txg & TXG_MASK];
@@ -437,9 +437,9 @@ spa_txg_history_fini_io(spa_t *spa, txg_stat_t *ts)
return;
}
- spa_config_enter(spa, SCL_ALL, FTAG, RW_READER);
+ spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
vdev_get_stats(spa->spa_root_vdev, &ts->vs2);
- spa_config_exit(spa, SCL_ALL, FTAG);
+ spa_config_exit(spa, SCL_CONFIG, FTAG);
spa_txg_history_set(spa, ts->txg, TXG_STATE_SYNCED, gethrtime());
spa_txg_history_set_io(spa, ts->txg,
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index a803833ba..1332c720f 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -3892,7 +3892,6 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
vs->vs_resilver_deferred = vd->vdev_resilver_deferred;
}
- ASSERT(spa_config_held(vd->vdev_spa, SCL_ALL, RW_READER) != 0);
vdev_get_stats_ex_impl(vd, vs, vsx);
mutex_exit(&vd->vdev_stat_lock);
}