aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2003-09-20 00:21:48 +0000
committerJeff Roberson <jeff@FreeBSD.org>2003-09-20 00:21:48 +0000
commit51b575490c8776d2a903861d309976418b0925f6 (patch)
treee064886f22ea0d1a5cdb0c19a1a075e8b3c309ab
parent9586afbe64bf5225253cb50ba06cb11b43acf7e8 (diff)
Notes
-rw-r--r--sys/kern/vfs_subr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7a32058db7b7a..2506e113e677f 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1869,12 +1869,14 @@ reassignbuf(bp, newvp)
register struct buf *bp;
register struct vnode *newvp;
{
+ struct vnode *vp;
int delay;
if (newvp == NULL) {
printf("reassignbuf: NULL");
return;
}
+ vp = bp->b_vp;
++reassignbufcalls;
/*
@@ -1887,20 +1889,22 @@ reassignbuf(bp, newvp)
/*
* Delete from old vnode list, if on one.
*/
- VI_LOCK(bp->b_vp);
+ VI_LOCK(vp);
if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) {
buf_vlist_remove(bp);
- if (bp->b_vp != newvp) {
+ if (vp != newvp) {
vdropl(bp->b_vp);
bp->b_vp = NULL; /* for clarification */
}
}
- VI_UNLOCK(bp->b_vp);
+ if (vp != newvp) {
+ VI_UNLOCK(vp);
+ VI_LOCK(newvp);
+ }
/*
* If dirty, put on list of dirty buffers; otherwise insert onto list
* of clean buffers.
*/
- VI_LOCK(newvp);
if (bp->b_flags & B_DELWRI) {
if ((newvp->v_iflag & VI_ONWORKLST) == 0) {
switch (newvp->v_type) {
@@ -2580,13 +2584,14 @@ vclean(vp, flags, td)
VI_LOCK(vp);
v_incr_usecount(vp, -1);
if (vp->v_usecount <= 0) {
-#ifdef DIAGNOSTIC
+#ifdef INVARIANTS
if (vp->v_usecount < 0 || vp->v_writecount != 0) {
vprint("vclean: bad ref count", vp);
panic("vclean: ref cnt");
}
#endif
- vfree(vp);
+ if (VSHOULDFREE(vp))
+ vfree(vp);
}
VI_UNLOCK(vp);
}