summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2013-11-27 15:48:43 +0000
committerjsing <jsing@openbsd.org>2013-11-27 15:48:43 +0000
commit0a10088338625ffb8f0bbb838c93d0993f9670a0 (patch)
tree2b7286d50b2917f472af1a95eabc62c80ae820c0
parentunsigned char cast was on a wrong place. (diff)
downloadwireguard-openbsd-0a10088338625ffb8f0bbb838c93d0993f9670a0.tar.xz
wireguard-openbsd-0a10088338625ffb8f0bbb838c93d0993f9670a0.zip
Assert that we never have destinations cached for a non-VDIR vnode.
ok beck@
-rw-r--r--sys/kern/vfs_cache.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 49ff3644fac..4c82103fd07 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_cache.c,v 1.35 2013/03/27 01:56:50 tedu Exp $ */
+/* $OpenBSD: vfs_cache.c,v 1.36 2013/11/27 15:48:43 jsing Exp $ */
/* $NetBSD: vfs_cache.c,v 1.13 1996/02/04 02:18:09 christos Exp $ */
/*
@@ -430,6 +430,9 @@ cache_purge(struct vnode *vp)
{
struct namecache *ncp;
+ /* We should never have destinations cached for a non-VDIR vnode. */
+ KASSERT(vp->v_type == VDIR || TAILQ_EMPTY(&vp->v_cache_dst));
+
while ((ncp = TAILQ_FIRST(&vp->v_cache_dst)))
cache_zap(ncp);
while ((ncp = RB_ROOT(&vp->v_nc_tree)))