diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index e1d5610a5d6b..597326590cbc 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.22 1997/02/22 09:40:46 peter Exp $ */ +/* $Id: msdosfs_denode.c,v 1.23 1997/02/26 14:23:11 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -750,7 +750,9 @@ msdosfs_inactive(ap) printf("msdosfs_inactive(): v_usecount %d, de_Name[0] %x\n", vp->v_usecount, dep->de_Name[0]); #endif + if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; + return error; } diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 7f01c7bc98ed..5d6605480565 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.91 1997/08/16 19:15:08 wollman Exp $ + * $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $ */ /* @@ -1089,11 +1089,11 @@ vputrele(vp, put) panic("vputrele: null vp"); #endif simple_lock(&vp->v_interlock); - vp->v_usecount--; - if ((vp->v_usecount == 1) && + if ((vp->v_usecount == 2) && vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) { + vp->v_usecount--; vp->v_object->flags &= ~OBJ_VFS_REF; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); @@ -1104,7 +1104,8 @@ vputrele(vp, put) return; } - if (vp->v_usecount > 0) { + if (vp->v_usecount > 1) { + vp->v_usecount--; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); } else { @@ -1113,23 +1114,12 @@ vputrele(vp, put) return; } - if (vp->v_usecount < 0) { + if (vp->v_usecount < 1) { #ifdef DIAGNOSTIC vprint("vputrele: negative ref count", vp); #endif panic("vputrele: negative ref cnt"); } - simple_lock(&vnode_free_list_slock); - if (vp->v_flag & VAGE) { - vp->v_flag &= ~VAGE; - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); - } else { - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); - } - freevnodes++; - simple_unlock(&vnode_free_list_slock); /* * If we are doing a vput, the node is already locked, and we must @@ -1142,6 +1132,19 @@ vputrele(vp, put) } else if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) == 0) { VOP_INACTIVE(vp, p); } + + vp->v_usecount--; + simple_lock(&vnode_free_list_slock); + if (vp->v_flag & VAGE) { + vp->v_flag &= ~VAGE; + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); + } else { + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } + freevnodes++; + simple_unlock(&vnode_free_list_slock); } /* diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7f01c7bc98ed..5d6605480565 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.91 1997/08/16 19:15:08 wollman Exp $ + * $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $ */ /* @@ -1089,11 +1089,11 @@ vputrele(vp, put) panic("vputrele: null vp"); #endif simple_lock(&vp->v_interlock); - vp->v_usecount--; - if ((vp->v_usecount == 1) && + if ((vp->v_usecount == 2) && vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) { + vp->v_usecount--; vp->v_object->flags &= ~OBJ_VFS_REF; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); @@ -1104,7 +1104,8 @@ vputrele(vp, put) return; } - if (vp->v_usecount > 0) { + if (vp->v_usecount > 1) { + vp->v_usecount--; if (put) { VOP_UNLOCK(vp, LK_INTERLOCK, p); } else { @@ -1113,23 +1114,12 @@ vputrele(vp, put) return; } - if (vp->v_usecount < 0) { + if (vp->v_usecount < 1) { #ifdef DIAGNOSTIC vprint("vputrele: negative ref count", vp); #endif panic("vputrele: negative ref cnt"); } - simple_lock(&vnode_free_list_slock); - if (vp->v_flag & VAGE) { - vp->v_flag &= ~VAGE; - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); - } else { - if(vp->v_tag != VT_TFS) - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); - } - freevnodes++; - simple_unlock(&vnode_free_list_slock); /* * If we are doing a vput, the node is already locked, and we must @@ -1142,6 +1132,19 @@ vputrele(vp, put) } else if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) == 0) { VOP_INACTIVE(vp, p); } + + vp->v_usecount--; + simple_lock(&vnode_free_list_slock); + if (vp->v_flag & VAGE) { + vp->v_flag &= ~VAGE; + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist); + } else { + if(vp->v_tag != VT_TFS) + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } + freevnodes++; + simple_unlock(&vnode_free_list_slock); } /* diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index e1d5610a5d6b..597326590cbc 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.22 1997/02/22 09:40:46 peter Exp $ */ +/* $Id: msdosfs_denode.c,v 1.23 1997/02/26 14:23:11 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -750,7 +750,9 @@ msdosfs_inactive(ap) printf("msdosfs_inactive(): v_usecount %d, de_Name[0] %x\n", vp->v_usecount, dep->de_Name[0]); #endif + if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; + return error; } diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 25df2a57546f..29b5dff59ec9 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 - * $Id: ufs_inode.c,v 1.11 1997/02/22 09:47:48 peter Exp $ + * $Id: ufs_inode.c,v 1.12 1997/03/22 06:53:44 bde Exp $ */ #include "opt_quota.h" @@ -104,7 +104,7 @@ ufs_inactive(ap) * so that it can be reused immediately. */ if (ip->i_mode == 0) - vrecycle(vp, (struct simplelock *)0, p); + vp->v_flag |= VAGE; return (error); } diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index d2583513144a..fab8b9991b5f 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 - * $Id: vnode_pager.c,v 1.70 1997/03/08 04:33:47 dyson Exp $ + * $Id: vnode_pager.c,v 1.71 1997/05/19 14:36:56 dfr Exp $ */ /* @@ -199,7 +199,6 @@ vnode_pager_dealloc(object) vp->v_object = NULL; vp->v_flag &= ~(VTEXT | VVMIO); - vp->v_flag |= VAGE; vrele(vp); }