From 3158c2e3cba16bdc8b830d8b1f181bcf1e6783d2 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 26 Jan 2022 14:23:39 -0500 Subject: [PATCH] FreeBSD: Fix zvol_cdev_open locking First open locking changes were correctly applied to zvol_geom_open but incorrectly applied to zvol_cdev_open, causing spa_namespace_lock to be held indefinitely. Make the first open locking in zvol_cdev_open match zvol_geom_open. Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #13016 --- module/os/freebsd/zfs/zvol_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/os/freebsd/zfs/zvol_os.c b/module/os/freebsd/zfs/zvol_os.c index 8785557cb..06dd8cfdd 100644 --- a/module/os/freebsd/zfs/zvol_os.c +++ b/module/os/freebsd/zfs/zvol_os.c @@ -928,8 +928,8 @@ retry: */ if (!mutex_owned(&spa_namespace_lock)) { if (!mutex_tryenter(&spa_namespace_lock)) { - rw_exit(&zvol_state_lock); - mutex_enter(&spa_namespace_lock); + mutex_exit(&zv->zv_state_lock); + rw_exit(&zv->zv_suspend_lock); kern_yield(PRI_USER); goto retry; } else {