mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
zvol: Fix suspend lock leaks (#16270)
In several functions, we use a flag variable to track whether zv_suspend_lock is held. This flag was not getting reset in a particular case where we need to retry the underlying operation, resulting in a lock leak. Make sure to update the flag where necessary. Signed-off-by: Mark Johnston <markj@FreeBSD.org> Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
parent
326040b285
commit
4367312760
@ -292,6 +292,7 @@ zvol_geom_open(struct g_provider *pp, int flag, int count)
|
||||
if (!mutex_tryenter(&spa_namespace_lock)) {
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
rw_exit(&zv->zv_suspend_lock);
|
||||
drop_suspend = B_FALSE;
|
||||
kern_yield(PRI_USER);
|
||||
goto retry;
|
||||
} else {
|
||||
@ -983,6 +984,7 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
||||
if (!mutex_tryenter(&spa_namespace_lock)) {
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
rw_exit(&zv->zv_suspend_lock);
|
||||
drop_suspend = B_FALSE;
|
||||
kern_yield(PRI_USER);
|
||||
goto retry;
|
||||
} else {
|
||||
|
@ -791,6 +791,7 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
if (!mutex_tryenter(&spa_namespace_lock)) {
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
rw_exit(&zv->zv_suspend_lock);
|
||||
drop_suspend = B_FALSE;
|
||||
|
||||
#ifdef HAVE_BLKDEV_GET_ERESTARTSYS
|
||||
schedule();
|
||||
|
Loading…
Reference in New Issue
Block a user