mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Handle closing an unopened ZVOL
Thank to commit a4430fce69
we're
now correctly returning EROFS when opening a zvol on a read-only
pool. Unfortunately, it looks like this causes us to trigger
some unexpected behavior by __blkdev_get().
In the failure case it's possible __blkdev_get() will call
__blkdev_put() for a bdev which was never successfully opened.
This results in us trying to close the device again and hitting
the NULL dereference.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1343
This commit is contained in:
parent
a127e841de
commit
0365064a97
@ -1055,11 +1055,11 @@ zvol_release(struct gendisk *disk, fmode_t mode)
|
||||
drop_mutex = 1;
|
||||
}
|
||||
|
||||
ASSERT3P(zv, !=, NULL);
|
||||
ASSERT3U(zv->zv_open_count, >, 0);
|
||||
if (zv->zv_open_count > 0) {
|
||||
zv->zv_open_count--;
|
||||
if (zv->zv_open_count == 0)
|
||||
zvol_last_close(zv);
|
||||
}
|
||||
|
||||
if (drop_mutex)
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user