- Hold the vnode interlock across calls to bgetvp instead of acquiring it

internally.  This is required to stop multiple bufs from being associated
   with a single lblkno.
This commit is contained in:
Jeff Roberson 2003-03-02 06:05:23 +00:00
parent ed403545fc
commit 491081fabf
2 changed files with 5 additions and 3 deletions

View File

@ -806,7 +806,10 @@ bwrite(struct buf * bp)
memcpy(newbp->b_data, bp->b_data, bp->b_bufsize);
newbp->b_lblkno = bp->b_lblkno;
newbp->b_xflags |= BX_BKGRDMARKER;
/* XXX The BX_ flags need to be protected as well */
VI_LOCK(bp->b_vp);
bgetvp(bp->b_vp, newbp);
VI_UNLOCK(bp->b_vp);
newbp->b_blkno = bp->b_blkno;
newbp->b_offset = bp->b_offset;
newbp->b_iodone = vfs_backgroundwritedone;
@ -2554,7 +2557,6 @@ loop:
brelse(bp);
goto loop;
}
VI_UNLOCK(vp);
/*
* Insert the buffer into the hash, so that it can
@ -2564,6 +2566,7 @@ loop:
bp->b_offset = offset;
bgetvp(vp, bp);
VI_UNLOCK(vp);
/*
* set B_VMIO bit. allocbuf() the buffer bigger. Since the

View File

@ -1593,7 +1593,7 @@ bgetvp(vp, bp)
KASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) == 0,
("bgetvp: bp already attached! %p", bp));
VI_LOCK(vp);
ASSERT_VI_LOCKED(vp, "bgetvp");
vholdl(vp);
bp->b_vp = vp;
bp->b_dev = vn_todev(vp);
@ -1603,7 +1603,6 @@ bgetvp(vp, bp)
s = splbio();
buf_vlist_add(bp, vp, BX_VNCLEAN);
splx(s);
VI_UNLOCK(vp);
}
/*