summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-08-26 04:36:27 +0000
committerdyson <dyson@FreeBSD.org>1997-08-26 04:36:27 +0000
commitb90433b1a924022c19ceee85ec65827dc47bc039 (patch)
treebdc95eb0fcbd9232b05d0c7f981fdfab0c4f98cb /sys/kern
parentc86802a2aefedc8e4193d369616e502bb635d002 (diff)
downloadFreeBSD-src-b90433b1a924022c19ceee85ec65827dc47bc039.zip
FreeBSD-src-b90433b1a924022c19ceee85ec65827dc47bc039.tar.gz
Back out some incorrect changes that was worse than the original bug.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c10
-rw-r--r--sys/kern/vfs_export.c37
-rw-r--r--sys/kern/vfs_subr.c37
3 files changed, 37 insertions, 47 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 5d726eb..fc991ad 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -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;
}
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 5d66054..5d01d8e 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.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);
}
/*
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5d66054..5d01d8e 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.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);
}
/*
OpenPOWER on IntegriCloud