mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
FreeBSD: Prevent a NULL reference in zvol_cdev_open
Check if the ZVOL has been written before calling zil_async_to_sync. The ZIL will be opened on the first write, not earlier. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org> Closes #11152
This commit is contained in:
parent
a4246bce50
commit
ae37ceadaa
@ -891,7 +891,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
if (flags & (FSYNC | FDSYNC)) {
|
if (flags & (FSYNC | FDSYNC)) {
|
||||||
zsd = &zv->zv_zso->zso_dev;
|
zsd = &zv->zv_zso->zso_dev;
|
||||||
zsd->zsd_sync_cnt++;
|
zsd->zsd_sync_cnt++;
|
||||||
if (zsd->zsd_sync_cnt == 1)
|
if (zsd->zsd_sync_cnt == 1 &&
|
||||||
|
(zv->zv_flags & ZVOL_WRITTEN_TO) != 0)
|
||||||
zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ);
|
zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user