summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-04-19 09:25:34 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-04-19 09:25:34 +0000
commit96817a934b43c1020aa5bd99dc181772aeb098de (patch)
tree026d6f125ad9e5d3855bed92805f3d4cc28a8353 /sys
parentec2a3965f865cd6d061f2aae91bb5c485817e305 (diff)
Fix freeing of namecache entries in cache_purgevfs(), okay miod@ art@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_cache.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 7cbc61502f1..1c3cc2e1953 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_cache.c,v 1.20 2007/04/19 07:45:20 art Exp $ */
+/* $OpenBSD: vfs_cache.c,v 1.21 2007/04/19 09:25:33 pedro Exp $ */
/* $NetBSD: vfs_cache.c,v 1.13 1996/02/04 02:18:09 christos Exp $ */
/*
@@ -434,12 +434,13 @@ cache_purge(struct vnode *vp)
void
cache_purgevfs(struct mount *mp)
{
- struct namecache *ncp;
-
- TAILQ_FOREACH(ncp, &nclruhead, nc_lru) {
- if (ncp->nc_dvp == NULL || ncp->nc_dvp->v_mount != mp) {
+ struct namecache *ncp, *nxtcp;
+
+ for (ncp = TAILQ_FIRST(&nclruhead); ncp != TAILQ_END(&nclruhead);
+ ncp = nxtcp) {
+ nxtcp = TAILQ_NEXT(ncp, nc_lru);
+ if (ncp->nc_dvp == NULL || ncp->nc_dvp->v_mount != mp)
continue;
- }
/* free the resources we had */
ncp->nc_vp = NULL;
ncp->nc_dvp = NULL;