From cf56f2b873e67e5bb0859edbe97a0886d96eb6bd Mon Sep 17 00:00:00 2001 From: yamt Date: Thu, 27 Jan 2005 11:33:26 +0000 Subject: [PATCH] keep directory eof cache when inactivating vnode because there's no reason to throw it away. (fix an unintended side effect of nfs_subs.c rev.1.144.) --- sys/nfs/nfs_node.c | 9 +++++---- sys/nfs/nfs_subs.c | 12 +++++++----- sys/nfs/nfs_var.h | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index 92827354f3e7..5b56700de6a2 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_node.c,v 1.77 2004/04/25 16:42:42 simonb Exp $ */ +/* $NetBSD: nfs_node.c,v 1.78 2005/01/27 11:33:26 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.77 2004/04/25 16:42:42 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.78 2005/01/27 11:33:26 yamt Exp $"); #include "opt_nfs.h" @@ -246,14 +246,15 @@ nfs_inactive(v) nfs_vinvalbuf(vp, 0, sp->s_cred, p, 1); removed = (np->n_flag & NREMOVED) != 0; np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED | - NQNFSNONCACHE | NQNFSWRITE); + NQNFSNONCACHE | NQNFSWRITE | NEOFVALID); if ((nmp->nm_flag & NFSMNT_NQNFS) && CIRCLEQ_NEXT(np, n_timer) != 0) { CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer); } if (vp->v_type == VDIR && np->n_dircache) - nfs_invaldircache(vp, 1); + nfs_invaldircache(vp, + NFS_INVALDIRCACHE_FORCE | NFS_INVALDIRCACHE_KEEPEOF); VOP_UNLOCK(vp, 0); diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index e22d80909dfb..9c83dbb76dc6 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_subs.c,v 1.144 2005/01/26 10:30:58 yamt Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.145 2005/01/27 11:33:26 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.144 2005/01/26 10:30:58 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.145 2005/01/27 11:33:26 yamt Exp $"); #include "fs_nfs.h" #include "opt_nfs.h" @@ -1502,20 +1502,22 @@ done: } void -nfs_invaldircache(vp, forcefree) +nfs_invaldircache(vp, flags) struct vnode *vp; - int forcefree; + int flags; { struct nfsnode *np = VTONFS(vp); struct nfsdircache *ndp = NULL; struct nfsmount *nmp = VFSTONFS(vp->v_mount); + const boolean_t forcefree = flags & NFS_INVALDIRCACHE_FORCE; #ifdef DIAGNOSTIC if (vp->v_type != VDIR) panic("nfs: invaldircache: not dir"); #endif - np->n_flag &= ~NEOFVALID; + if ((flags & NFS_INVALDIRCACHE_KEEPEOF) == 0) + np->n_flag &= ~NEOFVALID; if (!np->n_dircache) return; diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h index 844682805fe3..53befa41e150 100644 --- a/sys/nfs/nfs_var.h +++ b/sys/nfs/nfs_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_var.h,v 1.48 2005/01/19 16:22:19 yamt Exp $ */ +/* $NetBSD: nfs_var.h,v 1.49 2005/01/27 11:33:26 yamt Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -265,6 +265,8 @@ struct nfsdircache *nfs_searchdircache __P((struct vnode *, off_t, int, int *)); struct nfsdircache *nfs_enterdircache __P((struct vnode *, off_t, off_t, int, daddr_t)); void nfs_putdircache __P((struct nfsnode *, struct nfsdircache *)); void nfs_invaldircache __P((struct vnode *, int)); +#define NFS_INVALDIRCACHE_FORCE 1 +#define NFS_INVALDIRCACHE_KEEPEOF 2 void nfs_init __P((void)); int nfsm_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, struct vattr *, int flags));