MFC: Set flag in needsbuffer while still holding bqlock to avoid lost wakeup.

This commit is contained in:
tegge 2006-01-21 20:41:42 +00:00
parent 83bc9841ac
commit 637c08fadb

View File

@ -1864,7 +1864,6 @@ getnewbuf(int slpflag, int slptimeo, int size, int maxsize)
int flags;
char *waitmsg;
mtx_unlock(&bqlock);
if (defrag) {
flags = VFS_BIO_NEED_BUFSPACE;
waitmsg = "nbufkv";
@ -1875,11 +1874,14 @@ getnewbuf(int slpflag, int slptimeo, int size, int maxsize)
waitmsg = "newbuf";
flags = VFS_BIO_NEED_ANY;
}
mtx_lock(&nblock);
needsbuffer |= flags;
mtx_unlock(&nblock);
mtx_unlock(&bqlock);
bd_speedup(); /* heeeelp */
mtx_lock(&nblock);
needsbuffer |= flags;
while (needsbuffer & flags) {
if (msleep(&needsbuffer, &nblock,
(PRIBIO + 4) | slpflag, waitmsg, slptimeo)) {