Skip to content

Commit fe2e76a

Browse files
committed
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Mariusz Zaborski <[email protected]> OpenZFS Pull Request: openzfs/zfs#11152 PR: 250934
1 parent 4abd460 commit fe2e76a

File tree

1 file changed

+2
-1
lines changed
  • sys/contrib/openzfs/module/os/freebsd/zfs

1 file changed

+2
-1
lines changed

sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
890890
if (flags & (FSYNC | FDSYNC)) {
891891
zsd = &zv->zv_zso->zso_dev;
892892
zsd->zsd_sync_cnt++;
893-
if (zsd->zsd_sync_cnt == 1)
893+
if (zsd->zsd_sync_cnt == 1 &&
894+
(zv->zv_flags & ZVOL_WRITTEN_TO) != 0)
894895
zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ);
895896
}
896897

0 commit comments

Comments
 (0)