aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2021-02-24 10:00:21 -0800
committerGitHub <[email protected]>2021-02-24 10:00:21 -0800
commit75a089ed34befb8d11df9be92a4438cc49554bf6 (patch)
treeae09fbbf5cd09104d0f39a0a3bd4f2988d5079c0 /module/zfs
parent3ee4e6d8b7925d3b83dd7745e873d27983f9e995 (diff)
Fix overly broad locking in spa_vdev_config_exit()
Calling vdev_free() only requires the we acquire the spa config SCL_STATE_ALL locks, not the SCL_ALL locks. In particular, we need need to avoid taking the SCL_CONFIG lock (included in SCL_ALL) as a writer since this can lead to a deadlock. The txg_sync_thread() may block in spa_txg_history_init_io() when taking the SCL_CONFIG lock as a reading when it detects there's a pending writer. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Mark Maybee <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11585
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/spa_misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index e6e9b0e0b..0dacf9027 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -1284,9 +1284,9 @@ spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag)
*/
vdev_autotrim_stop_wait(vd);
- spa_config_enter(spa, SCL_ALL, spa, RW_WRITER);
+ spa_config_enter(spa, SCL_STATE_ALL, spa, RW_WRITER);
vdev_free(vd);
- spa_config_exit(spa, SCL_ALL, spa);
+ spa_config_exit(spa, SCL_STATE_ALL, spa);
}
/*