Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/sys/nfs Pullup rev 1.140 (requested by yamt in ticket #...



details:   https://anonhg.NetBSD.org/src/rev/ebbab0bc23fa
branches:  netbsd-2-0
changeset: 564670:ebbab0bc23fa
user:      jmc <jmc%NetBSD.org@localhost>
date:      Tue Jan 11 06:41:35 2005 +0000

description:
Pullup rev 1.140 (requested by yamt in ticket #1079)

        Invalidate cache if filesize is changed besides our activity
        because it means that were out of sync with the server.

diffstat:

 sys/nfs/nfs_subs.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (54 lines):

diff -r f7fdde428af6 -r ebbab0bc23fa sys/nfs/nfs_subs.c
--- a/sys/nfs/nfs_subs.c        Tue Jan 11 06:40:19 2005 +0000
+++ b/sys/nfs/nfs_subs.c        Tue Jan 11 06:41:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_subs.c,v 1.132.2.3 2004/10/04 06:05:30 jmc Exp $   */
+/*     $NetBSD: nfs_subs.c,v 1.132.2.4 2005/01/11 06:41:35 jmc Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.132.2.3 2004/10/04 06:05:30 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.132.2.4 2005/01/11 06:41:35 jmc Exp $");
 
 #include "fs_nfs.h"
 #include "opt_nfs.h"
@@ -1825,15 +1825,17 @@
                } else {
                        np->n_size = vap->va_size;
                        if (vap->va_type == VREG) {
-                               if ((flags & NAC_NOTRUNC)
-                                   && np->n_size < vp->v_size) {
-                                       /*
-                                        * we can't free pages now because
-                                        * the pages can be owned by ourselves.
-                                        */
+                               /*
+                                * we can't free pages if NAC_NOTRUNC because
+                                * the pages can be owned by ourselves.
+                                */
+                               if (flags & NAC_NOTRUNC) {
                                        np->n_flag |= NTRUNCDELAYED;
-                               }
-                               else {
+                               } else {
+                                       simple_lock(&vp->v_interlock);
+                                       (void)VOP_PUTPAGES(vp, 0,
+                                           0, PGO_SYNCIO | PGO_CLEANIT |
+                                           PGO_FREE | PGO_ALLPAGES);
                                        uvm_vnp_setsize(vp, np->n_size);
                                }
                        }
@@ -1903,6 +1905,9 @@
 
        if (np->n_flag & NTRUNCDELAYED) {
                np->n_flag &= ~NTRUNCDELAYED;
+               simple_lock(&vp->v_interlock);
+               (void)VOP_PUTPAGES(vp, 0,
+                   0, PGO_SYNCIO | PGO_CLEANIT | PGO_FREE | PGO_ALLPAGES);
                uvm_vnp_setsize(vp, np->n_size);
        }
 }



Home | Main Index | Thread Index | Old Index