From 8e43fa12c571878f32119122771888ab9092a75a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 24 Feb 2021 10:01:00 -0800 Subject: [PATCH] Fix vdev_rebuild_thread deadlock The metaslab_disable() call may block waiting for a txg sync. Therefore it's important that vdev_rebuild_thread release the SCL_CONFIG read lock it is holding before this call. Failure to do so can result in the txg_sync thread getting blocked waiting for this lock which results in a deadlock. Reviewed-by: Mark Maybee Reviewd-by: Srikanth N S Signed-off-by: Brian Behlendorf Closes #11647 --- module/zfs/vdev_rebuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c index 037abc01f7..a77ff99faa 100644 --- a/module/zfs/vdev_rebuild.c +++ b/module/zfs/vdev_rebuild.c @@ -807,8 +807,8 @@ vdev_rebuild_thread(void *arg) ASSERT0(range_tree_space(vr->vr_scan_tree)); /* Disable any new allocations to this metaslab */ - metaslab_disable(msp); spa_config_exit(spa, SCL_CONFIG, FTAG); + metaslab_disable(msp); mutex_enter(&msp->ms_sync_lock); mutex_enter(&msp->ms_lock);