Author: oshogbo
Date: Sun Nov  8 14:08:00 2020
New Revision: 367487
URL: https://svnweb.freebsd.org/changeset/base/367487

Log:
  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 <r...@ixsystems.com>
  Reviewed-by: Brian Behlendorf <behlendo...@llnl.gov>
  Signed-off-by: Mariusz Zaborski <osho...@vexillium.org>
  OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11152
  PR:           250934

Modified:
  head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c

Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c
==============================================================================
--- head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c    Sun Nov  8 
13:30:44 2020        (r367486)
+++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c    Sun Nov  8 
14:08:00 2020        (r367487)
@@ -890,7 +890,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, s
        if (flags & (FSYNC | FDSYNC)) {
                zsd = &zv->zv_zso->zso_dev;
                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);
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to