summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>1998-09-29 23:28:32 +0000
committermckusick <mckusick@FreeBSD.org>1998-09-29 23:28:32 +0000
commit17402e8897afa757a79c2fae7f24e638041df4f4 (patch)
treee41aa26e233e6659c58f5c43c46cec08abb79641 /sys/nfs
parent8fcb760f37a9f0881158fd93359e4f1e6a9743d0 (diff)
downloadFreeBSD-src-17402e8897afa757a79c2fae7f24e638041df4f4.zip
FreeBSD-src-17402e8897afa757a79c2fae7f24e638041df4f4.tar.gz
During truncation, have to notify the VM about the new size
of the NFS file *before* doing the nfs_vinvalbuf operation. Otherwise some invalid data may show up in an mmap.
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_vnops.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 385f6f6..ea0f110 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
- * $Id: nfs_vnops.c,v 1.105 1998/07/04 20:45:37 julian Exp $
+ * $Id: nfs_vnops.c,v 1.106 1998/08/13 08:09:08 dfr Exp $
*/
@@ -622,6 +622,7 @@ nfs_setattr(ap)
*/
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
+ vnode_pager_setsize(vp, (u_long)vap->va_size);
if (np->n_flag & NMODIFIED) {
if (vap->va_size == 0)
error = nfs_vinvalbuf(vp, 0,
@@ -629,12 +630,13 @@ nfs_setattr(ap)
else
error = nfs_vinvalbuf(vp, V_SAVE,
ap->a_cred, ap->a_p, 1);
- if (error)
+ if (error) {
+ vnode_pager_setsize(vp, (u_long)np->n_size);
return (error);
+ }
}
tsize = np->n_size;
np->n_size = np->n_vattr.va_size = vap->va_size;
- vnode_pager_setsize(vp, (u_long)np->n_size);
};
} else if ((vap->va_mtime.tv_sec != VNOVAL ||
vap->va_atime.tv_sec != VNOVAL) && (np->n_flag & NMODIFIED) &&
OpenPOWER on IntegriCloud