Skip to content

Commit

Permalink
zfs: 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.

This change has been accepted upstream in openzfs/zfs#13016 but is not
yet merged.

Reviewed by:	mav
Fixes:		e92ffd9
Sponsored by:	iXsystems, Inc.
  • Loading branch information
Ryan Moeller authored and Ryan Moeller committed Jan 26, 2022
1 parent 9acd521 commit 47e46b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/contrib/openzfs/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 47e46b1

Please sign in to comment.