diff options
author | jeff <jeff@FreeBSD.org> | 2003-03-02 06:05:23 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-03-02 06:05:23 +0000 |
commit | 8e95e9172221aabf5978f7f50ae2308a105d6f6c (patch) | |
tree | 976a25ee203ede9f82c16e1e88827ecb12847fba | |
parent | 867cf33fa04654ebba5e14e5d7dda8839f2bef40 (diff) | |
download | FreeBSD-src-8e95e9172221aabf5978f7f50ae2308a105d6f6c.zip FreeBSD-src-8e95e9172221aabf5978f7f50ae2308a105d6f6c.tar.gz |
- 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.
-rw-r--r-- | sys/kern/vfs_bio.c | 5 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 368e1e0..10ad7dc 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -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 diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index d5beb0f..127787f 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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); } /* |