1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-10 14:02:43 +00:00

If the lock passed to getdirtybuf() is the softdep lock then the background

write completed wakeup could be missed.  Close the race by grabbing the lock
normally used for protection of bp->b_xflags.

Reviewed by:	truckman
This commit is contained in:
Tor Egge 2006-01-09 19:32:21 +00:00
parent c8c7711d66
commit 6c62b2acd0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154150

View File

@ -5901,6 +5901,19 @@ getdirtybuf(bp, mtx, waitfor)
return (NULL);
}
if ((bp->b_vflags & BV_BKGRDINPROG) != 0) {
if (mtx == &lk && waitfor == MNT_WAIT) {
mtx_unlock(mtx);
BO_LOCK(bp->b_bufobj);
BUF_UNLOCK(bp);
if ((bp->b_vflags & BV_BKGRDINPROG) != 0) {
bp->b_vflags |= BV_BKGRDWAIT;
msleep(&bp->b_xflags, BO_MTX(bp->b_bufobj),
PRIBIO | PDROP, "getbuf", 0);
} else
BO_UNLOCK(bp->b_bufobj);
mtx_lock(mtx);
return (NULL);
}
BUF_UNLOCK(bp);
if (waitfor != MNT_WAIT)
return (NULL);