Skip to content

Commit

Permalink
FreeBSD: Fix zvol_cdev_open locking
Browse files Browse the repository at this point in the history
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 <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#13016
  • Loading branch information
Ryan Moeller authored and nicman23 committed Aug 22, 2022
1 parent fa77154 commit 3c8b461
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/os/freebsd/zfs/zvol_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
*/
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 {
Expand Down

0 comments on commit 3c8b461

Please sign in to comment.