Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs nfs_lookup: check n_nctime for positive entries as w...
details: https://anonhg.NetBSD.org/src/rev/a2bf217acb32
branches: trunk
changeset: 572550:a2bf217acb32
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Jan 08 03:12:30 2005 +0000
description:
nfs_lookup: check n_nctime for positive entries as well to improve
cache consistency.
diffstat:
sys/nfs/nfs_vnops.c | 28 ++++++++++++++++------------
sys/nfs/nfsnode.h | 4 ++--
2 files changed, 18 insertions(+), 14 deletions(-)
diffs (86 lines):
diff -r 51360b6dd5ae -r a2bf217acb32 sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c Sat Jan 08 03:11:03 2005 +0000
+++ b/sys/nfs/nfs_vnops.c Sat Jan 08 03:12:30 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vnops.c,v 1.214 2004/12/17 03:31:20 yamt Exp $ */
+/* $NetBSD: nfs_vnops.c,v 1.215 2005/01/08 03:12:30 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.214 2004/12/17 03:31:20 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.215 2005/01/08 03:12:30 yamt Exp $");
#include "opt_inet.h"
#include "opt_nfs.h"
@@ -271,17 +271,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);
}
@@ -882,17 +881,22 @@
return err2;
}
- if (error == ENOENT) {
- if (!VOP_GETATTR(dvp, &vattr, cnp->cn_cred,
- cnp->cn_proc) && timespeccmp(&vattr.va_mtime,
- &VTONFS(dvp)->n_nctime, ==)) {
- goto noentry;
+ if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred,
+ cnp->cn_proc) || timespeccmp(&vattr.va_mtime,
+ &VTONFS(dvp)->n_nctime, !=)) {
+ if (error == 0) {
+ vrele(*vpp);
+ *vpp = NULLVP;
}
cache_purge1(dvp, NULL, PURGE_CHILDREN);
timespecclear(&np->n_nctime);
goto dorpc;
}
+ if (error == ENOENT) {
+ goto noentry;
+ }
+
newvp = *vpp;
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, cnp->cn_proc)
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
diff -r 51360b6dd5ae -r a2bf217acb32 sys/nfs/nfsnode.h
--- a/sys/nfs/nfsnode.h Sat Jan 08 03:11:03 2005 +0000
+++ b/sys/nfs/nfsnode.h Sat Jan 08 03:12:30 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfsnode.h,v 1.51 2004/12/14 09:15:23 yamt Exp $ */
+/* $NetBSD: nfsnode.h,v 1.52 2005/01/08 03:12:31 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -121,7 +121,7 @@
nfsuint64 ndir_cookieverf; /* Cookie verifier */
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