From 8670684a2f6afad862891d3ed53a882eb93d65ad Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 6 May 1997 15:19:38 +0000 Subject: [PATCH] Fix a race condition that did, after all, exist. Reviewed by: phk Submitted by: dfr --- sys/kern/vfs_export.c | 8 +++++--- sys/kern/vfs_subr.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 295c233990ef..353c8672ee5d 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.84 1997/04/30 03:09:15 dyson Exp $ + * $Id: vfs_subr.c,v 1.85 1997/05/04 09:17:29 phk Exp $ */ /* @@ -2149,8 +2149,10 @@ vtouch(vp) return; } if (simple_lock_try(&vnode_free_list_slock)) { - TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + if (vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb) { + TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } simple_unlock(&vnode_free_list_slock); } simple_unlock(&vp->v_interlock); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 295c233990ef..353c8672ee5d 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.84 1997/04/30 03:09:15 dyson Exp $ + * $Id: vfs_subr.c,v 1.85 1997/05/04 09:17:29 phk Exp $ */ /* @@ -2149,8 +2149,10 @@ vtouch(vp) return; } if (simple_lock_try(&vnode_free_list_slock)) { - TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + if (vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb) { + TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } simple_unlock(&vnode_free_list_slock); } simple_unlock(&vp->v_interlock);