From 2b1c6615bc29f94841689461fd485396dccd412d Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sat, 15 Mar 2008 23:23:04 +0000 Subject: [PATCH] Fix mmap(2) on ZFS after some changes in VM subsystem. Submitted by: alc Reported by: kris (originally) and many others Tested with: fsx MFC after: 1 week --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 4 ++++ sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 8c67a59eddb5..4008178f0297 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -346,6 +346,10 @@ mappedwrite(vnode_t *vp, int nbytes, uio_t *uio, dmu_tx_t *tx) VM_OBJECT_LOCK(obj); vm_page_wakeup(m); } else { + if (__predict_false(obj->cache != NULL)) { + vm_page_cache_free(obj, OFF_TO_IDX(start), + OFF_TO_IDX(start) + 1); + } dirbytes += bytes; } len -= bytes; diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 8c67a59eddb5..4008178f0297 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -346,6 +346,10 @@ mappedwrite(vnode_t *vp, int nbytes, uio_t *uio, dmu_tx_t *tx) VM_OBJECT_LOCK(obj); vm_page_wakeup(m); } else { + if (__predict_false(obj->cache != NULL)) { + vm_page_cache_free(obj, OFF_TO_IDX(start), + OFF_TO_IDX(start) + 1); + } dirbytes += bytes; } len -= bytes;