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.)
This commit is contained in:
yamt 2005-01-27 11:33:26 +00:00
parent 407a63dc34
commit cf56f2b873
3 changed files with 15 additions and 10 deletions

View File

@ -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 <sys/cdefs.h>
__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);

View File

@ -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 <sys/cdefs.h>
__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;

View File

@ -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));