vrecycle removed nfs vnodes.

not perfect, but enough for most cases.
This commit is contained in:
yamt 2003-07-30 12:25:39 +00:00
parent cc104d0635
commit 33164bffc6
3 changed files with 15 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_node.c,v 1.68 2003/06/29 22:32:15 fvdl Exp $ */ /* $NetBSD: nfs_node.c,v 1.69 2003/07/30 12:25:39 yamt Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -39,7 +39,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.68 2003/06/29 22:32:15 fvdl Exp $"); __KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.69 2003/07/30 12:25:39 yamt Exp $");
#include "opt_nfs.h" #include "opt_nfs.h"
@ -232,6 +232,7 @@ nfs_inactive(v)
struct proc *p = ap->a_p; struct proc *p = ap->a_p;
struct vnode *vp = ap->a_vp; struct vnode *vp = ap->a_vp;
struct nfsmount *nmp = VFSTONFS(vp->v_mount); struct nfsmount *nmp = VFSTONFS(vp->v_mount);
boolean_t removed;
np = VTONFS(vp); np = VTONFS(vp);
if (prtactive && vp->v_usecount != 0) if (prtactive && vp->v_usecount != 0)
@ -243,6 +244,7 @@ nfs_inactive(v)
sp = NULL; sp = NULL;
if (sp != NULL) if (sp != NULL)
nfs_vinvalbuf(vp, 0, sp->s_cred, p, 1); nfs_vinvalbuf(vp, 0, sp->s_cred, p, 1);
removed = (np->n_flag & NREMOVED) != 0;
np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED | np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED |
NQNFSNONCACHE | NQNFSWRITE); NQNFSNONCACHE | NQNFSWRITE);
VOP_UNLOCK(vp, 0); VOP_UNLOCK(vp, 0);
@ -266,6 +268,9 @@ nfs_inactive(v)
if (vp->v_type == VDIR && np->n_dircache) if (vp->v_type == VDIR && np->n_dircache)
nfs_invaldircache(vp, 1); nfs_invaldircache(vp, 1);
if (removed)
vrecycle(vp, NULL, p);
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vnops.c,v 1.175 2003/06/29 22:32:20 fvdl Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.176 2003/07/30 12:25:39 yamt Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.175 2003/06/29 22:32:20 fvdl Exp $"); __KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.176 2003/07/30 12:25:39 yamt Exp $");
#include "opt_nfs.h" #include "opt_nfs.h"
#include "opt_uvmhist.h" #include "opt_uvmhist.h"
@ -1744,6 +1744,10 @@ nfs_remove(v)
} else if (!np->n_sillyrename) } else if (!np->n_sillyrename)
error = nfs_sillyrename(dvp, vp, cnp); error = nfs_sillyrename(dvp, vp, cnp);
PNBUF_PUT(cnp->cn_pnbuf); PNBUF_PUT(cnp->cn_pnbuf);
if (!error && nfs_getattrcache(vp, &vattr) == 0 &&
vattr.va_nlink == 1) {
np->n_flag |= NREMOVED;
}
np->n_attrstamp = 0; np->n_attrstamp = 0;
VN_KNOTE(vp, NOTE_DELETE); VN_KNOTE(vp, NOTE_DELETE);
VN_KNOTE(dvp, NOTE_WRITE); VN_KNOTE(dvp, NOTE_WRITE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsnode.h,v 1.40 2003/05/07 16:18:54 yamt Exp $ */ /* $NetBSD: nfsnode.h,v 1.41 2003/07/30 12:25:39 yamt Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -175,6 +175,7 @@ LIST_HEAD(nfsnodehashhead, nfsnode);
#define NUPD 0x0200 /* Special file updated */ #define NUPD 0x0200 /* Special file updated */
#define NCHG 0x0400 /* Special file times changed */ #define NCHG 0x0400 /* Special file times changed */
#define NTRUNCDELAYED 0x1000 /* Should be truncated later */ #define NTRUNCDELAYED 0x1000 /* Should be truncated later */
#define NREMOVED 0x2000 /* Has been removed */
/* /*
* Convert between nfsnode pointers and vnode pointers * Convert between nfsnode pointers and vnode pointers