summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-02-05 01:26:14 +0000
committerjeff <jeff@FreeBSD.org>2005-02-05 01:26:14 +0000
commit0a084a15e2fcadf30a53e5ce4562b3906de0ff39 (patch)
tree7e514c6631749afc4050e929c77b7eb6fc987490 /sys
parente4c6b83cfd9d5d82f147b7ce2d61530cb03303db (diff)
downloadFreeBSD-src-0a084a15e2fcadf30a53e5ce4562b3906de0ff39.zip
FreeBSD-src-0a084a15e2fcadf30a53e5ce4562b3906de0ff39.tar.gz
- Don't release BKGRDINPROG until after we've bufdone'd the copy.
Sponsored by: Isilon Systems, Inc.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_bio.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 044e7e1..d36ceae 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -949,20 +949,6 @@ vfs_backgroundwritedone(struct buf *bp)
BO_LOCK(bp->b_bufobj);
if ((origbp = gbincore(bp->b_bufobj, bp->b_lblkno)) == NULL)
panic("backgroundwritedone: lost buffer");
-
- /*
- * Clear the BV_BKGRDINPROG flag in the original buffer
- * and awaken it if it is waiting for the write to complete.
- * If BV_BKGRDINPROG is not set in the original buffer it must
- * have been released and re-instantiated - which is not legal.
- */
- KASSERT((origbp->b_vflags & BV_BKGRDINPROG),
- ("backgroundwritedone: lost buffer2"));
- origbp->b_vflags &= ~BV_BKGRDINPROG;
- if (origbp->b_vflags & BV_BKGRDWAIT) {
- origbp->b_vflags &= ~BV_BKGRDWAIT;
- wakeup(&origbp->b_xflags);
- }
BO_UNLOCK(bp->b_bufobj);
/*
* Process dependencies then return any unfinished ones.
@@ -982,6 +968,21 @@ vfs_backgroundwritedone(struct buf *bp)
bp->b_flags &= ~(B_CACHE | B_DONE);
bp->b_iodone = 0;
bufdone(bp);
+ BO_LOCK(origbp->b_bufobj);
+ /*
+ * Clear the BV_BKGRDINPROG flag in the original buffer
+ * and awaken it if it is waiting for the write to complete.
+ * If BV_BKGRDINPROG is not set in the original buffer it must
+ * have been released and re-instantiated - which is not legal.
+ */
+ KASSERT((origbp->b_vflags & BV_BKGRDINPROG),
+ ("backgroundwritedone: lost buffer2"));
+ origbp->b_vflags &= ~BV_BKGRDINPROG;
+ if (origbp->b_vflags & BV_BKGRDWAIT) {
+ origbp->b_vflags &= ~BV_BKGRDWAIT;
+ wakeup(&origbp->b_xflags);
+ }
+ BO_UNLOCK(origbp->b_bufobj);
}
/*
OpenPOWER on IntegriCloud