summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_bio.c5
-rw-r--r--sys/kern/vfs_subr.c3
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);
}
/*
OpenPOWER on IntegriCloud