From 8a3d9186ba0c99834506392428c5c6cc3a0954a9 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 3 Jul 2020 14:30:04 -0400 Subject: [PATCH] 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 Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10527 Closes #10528 --- module/os/freebsd/zfs/zfs_vnops.c | 7 +++++-- 1 file 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);