ffs: Support O_DSYNC.

Respect the new IO_DATASYNC flag when performing synchronous writes.
Compared to O_SYNC, O_DSYNC lets us skip updating the inode in some
cases, matching the behaviour of fdatasync(2).

Reviewed by: kib
Differential Review: https://reviews.freebsd.org/D25160
This commit is contained in:
Thomas Munro committed 2021-01-08 13:15:56 +13:00
1 parent a5e284038e
commit e7347be9e3
1 file changed
+3 -1
+3 -1
View File
@@ -1001,7 +1001,9 @@ ffs_write(ap)
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
error = ffs_update(vp, 1);
if (!(ioflag & IO_DATASYNC) ||
(ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA)))
error = ffs_update(vp, 1);
if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), error))
error = ENXIO;
}