Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 2021 20:25:20 GMT
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e33a2b2905a8 - releng/13.0 - zfs: fix vdev_rebuild_thread deadlock
Message-ID:  <202103062025.126KPK2D074345@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/13.0 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=e33a2b2905a886e98ab4b8f8d83ed30f6d8bb254

commit e33a2b2905a886e98ab4b8f8d83ed30f6d8bb254
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2021-03-03 01:28:56 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2021-03-06 20:23:22 +0000

    zfs: fix vdev_rebuild_thread deadlock
    
    From the openzfs 8e43fa12c commit message:
      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.
    
    Obtained from:  openzfs/zfs@8e43fa12c571878f32119122771888ab9092a75a
    Approved by:    re (delphij)
    
    (cherry picked from commit c7069063144395b025c0ef178431eb2cafdbe1ca)
---
 sys/contrib/openzfs/module/zfs/vdev_rebuild.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c
index 784d1af15a81..112c04d0ba04 100644
--- a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c
+++ b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c
@@ -804,8 +804,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103062025.126KPK2D074345>