aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-07-03 14:30:04 -0400
committerGitHub <[email protected]>2020-07-03 11:30:04 -0700
commit8a3d9186ba0c99834506392428c5c6cc3a0954a9 (patch)
tree3270ad90dd46cd593f4fa11d366498d93bbd4221 /module
parent9a49d3f3d3bfa26df4e5e54d574cb490f0ee284b (diff)
Update zfs_freebsd_need_inactive to fix mmapped writes
`zfs_freebsd_need_inactive` appears to been based on an unfinished version of https://reviews.freebsd.org/D22130 which had a bug where files written via mmap wouldn't actually persist. Update the function to match the final version committed to FreeBSD. Authored-by: Mateusz Guzik <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10527 Closes #10528
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/zfs_vnops.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/module/os/freebsd/zfs/zfs_vnops.c b/module/os/freebsd/zfs/zfs_vnops.c
index cf684222b..6698e3655 100644
--- a/module/os/freebsd/zfs/zfs_vnops.c
+++ b/module/os/freebsd/zfs/zfs_vnops.c
@@ -5749,10 +5749,13 @@ zfs_freebsd_need_inactive(struct vop_need_inactive_args *ap)
vnode_t *vp = ap->a_vp;
znode_t *zp = VTOZ(vp);
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
- bool need;
+ int need;
+
+ if (vn_need_pageq_flush(vp))
+ return (1);
if (!rw_tryenter(&zfsvfs->z_teardown_inactive_lock, RW_READER))
- return (true);
+ return (1);
need = (zp->z_sa_hdl == NULL || zp->z_unlinked || zp->z_atime_dirty);
rw_exit(&zfsvfs->z_teardown_inactive_lock);