summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-04-24 17:58:14 +0000
committerphk <phk@FreeBSD.org>1999-04-24 17:58:14 +0000
commit711d7d880dfbdaa80494fa6d55d3dd97901d938c (patch)
treed445aa75bb769f525ab464c9bbf629fa94c1104c /sys
parent073326ad333d5e695388960875e6d66f94f0a361 (diff)
downloadFreeBSD-src-711d7d880dfbdaa80494fa6d55d3dd97901d938c.zip
FreeBSD-src-711d7d880dfbdaa80494fa6d55d3dd97901d938c.tar.gz
Fix a braino in the v_id wraparound code. Give more (current) details
in comment. PR: 11307 Spotted by: Ville-Pertti Keinonen <will@iki.fi>
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_cache.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index a8ac5e7..ac6082f 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95
- * $Id: vfs_cache.c,v 1.37 1997/12/19 23:18:37 bde Exp $
+ * $Id: vfs_cache.c,v 1.38 1998/09/09 07:41:41 bde Exp $
*/
#include <sys/param.h>
@@ -318,13 +318,21 @@ nchinit()
}
/*
- * Invalidate all entries to particular vnode.
+ * Invalidate all entries to a particular vnode.
*
- * We actually just increment the v_id, that will do it. The stale entries
- * will be purged by lookup as they get found. If the v_id wraps around, we
- * need to ditch the entire cache, to avoid confusion. No valid vnode will
- * ever have (v_id == 0).
+ * Remove all entries in the namecache relating to this vnode and
+ * change the v_id. We take the v_id from a global counter, since
+ * it becomes a handy sequence number in crash-dumps that way.
+ * No valid vnode will ever have (v_id == 0).
+ *
+ * XXX: Only time and the size of v_id prevents this from failing:
+ * XXX: In theory we should hunt down all (struct vnode*, v_id)
+ * XXX: soft references and nuke them, at least on the global
+ * XXX: v_id wraparound. The period of resistance can be extended
+ * XXX: by incrementing each vnodes v_id individually instead of
+ * XXX: using the global v_id.
*/
+
void
cache_purge(vp)
struct vnode *vp;
@@ -336,9 +344,9 @@ cache_purge(vp)
while (!TAILQ_EMPTY(&vp->v_cache_dst))
cache_zap(TAILQ_FIRST(&vp->v_cache_dst));
- nextid++;
- while (nextid == vp->v_id || !nextid)
- continue;
+ do
+ nextid++;
+ while (nextid == vp->v_id || !nextid);
vp->v_id = nextid;
vp->v_dd = vp;
vp->v_ddid = 0;
OpenPOWER on IntegriCloud