From 9720dc3374ac4331396d59d0a4da6751c88670c6 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 23 Oct 2021 17:39:08 +0000 Subject: [PATCH] Call uvm_vnp_uncache() in tmpfs_write(). We currently only call uvm_vnp_uncache() in tmpfs_write() when a file grows in size. This is not enough. We need to invalidate UVM's cache of the vnode every time the contents of the vnode are modified. Failure to do so might lead to inconsistencies between read/mmap consumers. From Pedro Martelletto --- sys/tmpfs/tmpfs_vnops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c index b1a4fe20cc0..690f09b1fec 100644 --- a/sys/tmpfs/tmpfs_vnops.c +++ b/sys/tmpfs/tmpfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmpfs_vnops.c,v 1.47 2021/10/23 17:38:00 patrick Exp $ */ +/* $OpenBSD: tmpfs_vnops.c,v 1.48 2021/10/23 17:39:08 patrick Exp $ */ /* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */ /* @@ -625,7 +625,7 @@ tmpfs_write(void *v) error = 0; while (error == 0 && uio->uio_resid > 0) { vsize_t len; - + uvm_vnp_uncache(vp); len = MIN(node->tn_size - uio->uio_offset, uio->uio_resid); if (len == 0) { break; -- 2.20.1