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 patch (requested by yamt in ticket #1077)



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

description:
Pullup patch (requested by yamt in ticket #1077)

        nfs_lookup: check n_nctime for positive entries as well to improve
        cache consistency.

diffstat:

 sys/nfs/nfs_vnops.c |  32 ++++++++++++++++++++------------
 sys/nfs/nfsnode.h   |   4 ++--
 2 files changed, 22 insertions(+), 14 deletions(-)

diffs (89 lines):

diff -r 8226e16c512f -r 15786c5fdcba sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Mon Jan 10 22:04:25 2005 +0000
+++ b/sys/nfs/nfs_vnops.c       Tue Jan 11 06:35:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.186.2.6 2004/07/10 20:03:55 tron Exp $ */
+/*     $NetBSD: nfs_vnops.c,v 1.186.2.7 2005/01/11 06:35:46 jmc Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.186.2.6 2004/07/10 20:03:55 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.186.2.7 2005/01/11 06:35:46 jmc Exp $");
 
 #include "opt_nfs.h"
 #include "opt_uvmhist.h"
@@ -273,17 +273,16 @@
 nfs_cache_enter(struct vnode *dvp, struct vnode *vp,
     struct componentname *cnp)
 {
+       struct nfsnode *dnp = VTONFS(dvp);
 
        if (vp != NULL) {
                struct nfsnode *np = VTONFS(vp);
 
                np->n_ctime = np->n_vattr->va_ctime.tv_sec;
-       } else {
-               struct nfsnode *dnp = VTONFS(dvp);
+       }
 
-               if (!timespecisset(&dnp->n_nctime))
-                       dnp->n_nctime = dnp->n_vattr->va_mtime;
-       }
+       if (!timespecisset(&dnp->n_nctime))
+               dnp->n_nctime = dnp->n_vattr->va_mtime;
 
        cache_enter(dvp, vp, cnp);
 }
@@ -886,16 +885,25 @@
                        return err2;
                }
 
-               if (error == ENOENT) {
-                       if (!VOP_GETATTR(dvp, &vattr, cnp->cn_cred,
-                           cnp->cn_proc) && timespeccmp(&vattr.va_mtime,
-                           &VTONFS(dvp)->n_nctime, ==))
-                               return ENOENT;
+               if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred,
+                   cnp->cn_proc) || timespeccmp(&vattr.va_mtime,
+                   &VTONFS(dvp)->n_nctime, !=)) {
+                       if (error == 0) {
+                               if (*vpp != dvp)
+                                       vput(*vpp);
+                               else
+                                       vrele(*vpp);
+                               *vpp = NULLVP;
+                       }
                        cache_purge1(dvp, NULL, PURGE_CHILDREN);
                        timespecclear(&np->n_nctime);
                        goto dorpc;
                }
 
+               if (error == ENOENT) {
+                       return ENOENT;
+               }
+
                newvp = *vpp;
                if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, cnp->cn_proc)
                        && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime)
diff -r 8226e16c512f -r 15786c5fdcba sys/nfs/nfsnode.h
--- a/sys/nfs/nfsnode.h Mon Jan 10 22:04:25 2005 +0000
+++ b/sys/nfs/nfsnode.h Tue Jan 11 06:35:42 2005 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: nfsnode.h,v 1.46.2.2 2004/09/18 19:22:41 he Exp $     */
+/*      $NetBSD: nfsnode.h,v 1.46.2.3 2005/01/11 06:35:42 jmc Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -119,7 +119,7 @@
        daddr_t ndir_dblkno;            /* faked dir blkno */
        struct nfsdirhashhead *ndir_dircache; /* offset -> cache hash heads */
        struct nfsdirchainhead ndir_dirchain; /* Chain of dir cookies */
-       struct timespec ndir_nctime;    /* Last neg cache entry */
+       struct timespec ndir_nctime;    /* Last name cache entry */
        unsigned ndir_dircachesize;     /* Size of dir cookie cache */
 };
 



Home | Main Index | Thread Index | Old Index