mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04: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:
parent
c8c7711d66
commit
6c62b2acd0
1 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue