mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Back out some incorrect changes that was worse than the original bug.
This commit is contained in:
parent
7d7fb492c5
commit
a5db4bf475
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28774
sys
fs/msdosfs
kern
msdosfs
ufs/ufs
@ -750,9 +750,7 @@ out:
|
||||
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)
|
||||
vp->v_flag |= VAGE;
|
||||
|
||||
vrecycle(vp, (struct simplelock *)0, p);
|
||||
return error;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vfs_bio.c,v 1.122 1997/08/09 10:13:12 dyson Exp $
|
||||
* $Id: vfs_bio.c,v 1.123 1997/08/21 01:35:37 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2196,7 +2196,7 @@ tryagain:
|
||||
bp->b_pages[index] = p;
|
||||
PAGE_WAKEUP(p);
|
||||
}
|
||||
bp->b_npages = index;
|
||||
bp->b_npages = to >> PAGE_SHIFT;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2204,11 +2204,11 @@ vm_hold_free_pages(struct buf * bp, vm_offset_t from, vm_offset_t to)
|
||||
{
|
||||
vm_offset_t pg;
|
||||
vm_page_t p;
|
||||
int index, newnpages;
|
||||
int index;
|
||||
|
||||
from = round_page(from);
|
||||
to = round_page(to);
|
||||
newnpages = index = (from - trunc_page(bp->b_data)) >> PAGE_SHIFT;
|
||||
index = (from - trunc_page(bp->b_data)) >> PAGE_SHIFT;
|
||||
|
||||
for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
|
||||
p = bp->b_pages[index];
|
||||
@ -2225,7 +2225,7 @@ vm_hold_free_pages(struct buf * bp, vm_offset_t from, vm_offset_t to)
|
||||
vm_page_free(p);
|
||||
}
|
||||
}
|
||||
bp->b_npages = newnpages;
|
||||
bp->b_npages = from >> PAGE_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $
|
||||
* $Id: vfs_subr.c,v 1.93 1997/08/22 03:56:29 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,8 +63,6 @@
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
#include <machine/limits.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/vm_object.h>
|
||||
@ -1089,11 +1087,11 @@ vputrele(vp, put)
|
||||
panic("vputrele: null vp");
|
||||
#endif
|
||||
simple_lock(&vp->v_interlock);
|
||||
vp->v_usecount--;
|
||||
|
||||
if ((vp->v_usecount == 2) &&
|
||||
if ((vp->v_usecount == 1) &&
|
||||
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,8 +1102,7 @@ vputrele(vp, put)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vp->v_usecount > 1) {
|
||||
vp->v_usecount--;
|
||||
if (vp->v_usecount > 0) {
|
||||
if (put) {
|
||||
VOP_UNLOCK(vp, LK_INTERLOCK, p);
|
||||
} else {
|
||||
@ -1114,12 +1111,23 @@ vputrele(vp, put)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vp->v_usecount < 1) {
|
||||
if (vp->v_usecount < 0) {
|
||||
#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
|
||||
@ -1132,19 +1140,6 @@ 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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.92 1997/08/21 20:33:39 bde Exp $
|
||||
* $Id: vfs_subr.c,v 1.93 1997/08/22 03:56:29 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,8 +63,6 @@
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
#include <machine/limits.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/vm_object.h>
|
||||
@ -1089,11 +1087,11 @@ vputrele(vp, put)
|
||||
panic("vputrele: null vp");
|
||||
#endif
|
||||
simple_lock(&vp->v_interlock);
|
||||
vp->v_usecount--;
|
||||
|
||||
if ((vp->v_usecount == 2) &&
|
||||
if ((vp->v_usecount == 1) &&
|
||||
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,8 +1102,7 @@ vputrele(vp, put)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vp->v_usecount > 1) {
|
||||
vp->v_usecount--;
|
||||
if (vp->v_usecount > 0) {
|
||||
if (put) {
|
||||
VOP_UNLOCK(vp, LK_INTERLOCK, p);
|
||||
} else {
|
||||
@ -1114,12 +1111,23 @@ vputrele(vp, put)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vp->v_usecount < 1) {
|
||||
if (vp->v_usecount < 0) {
|
||||
#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
|
||||
@ -1132,19 +1140,6 @@ 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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -750,9 +750,7 @@ out:
|
||||
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)
|
||||
vp->v_flag |= VAGE;
|
||||
|
||||
vrecycle(vp, (struct simplelock *)0, p);
|
||||
return error;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95
|
||||
* $Id: ufs_inode.c,v 1.12 1997/03/22 06:53:44 bde Exp $
|
||||
* $Id: ufs_inode.c,v 1.13 1997/08/22 03:56:35 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
@ -104,7 +104,7 @@ out:
|
||||
* so that it can be reused immediately.
|
||||
*/
|
||||
if (ip->i_mode == 0)
|
||||
vp->v_flag |= VAGE;
|
||||
vrecycle(vp, (struct simplelock *)0, p);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
|
||||
* $Id: ufs_vnops.c,v 1.53 1997/08/21 01:42:47 dyson Exp $
|
||||
* $Id: ufs_vnops.c,v 1.54 1997/08/22 15:37:23 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
@ -692,14 +692,6 @@ ufs_remove(ap)
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
}
|
||||
out:
|
||||
#if 0
|
||||
if ((ip->i_nlink == 0) &&
|
||||
((vp->v_object == NULL) && (vp->v_usecount == 1)) ||
|
||||
(vp->v_usecount <= 2)) {
|
||||
VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dvp == vp)
|
||||
vrele(vp);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user