Index: sys/kern/vfs_bio.c =================================================================== --- sys/kern/vfs_bio.c +++ sys/kern/vfs_bio.c @@ -4524,7 +4524,10 @@ mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); bp->b_flags |= B_DONE; - wakeup(bp); + if (bp->b_flags & B_WAITING) { + bp->b_flags &= ~B_WAITING; + wakeup(bp); + } mtx_unlock(mtxp); } @@ -4535,8 +4538,10 @@ mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); - while ((bp->b_flags & B_DONE) == 0) + while ((bp->b_flags & B_DONE) == 0) { + bp->b_flags |= B_WAITING; msleep(bp, mtxp, pri, wchan, 0); + } mtx_unlock(mtxp); } Index: sys/sys/buf.h =================================================================== --- sys/sys/buf.h +++ sys/sys/buf.h @@ -199,7 +199,7 @@ #define B_CACHE 0x00000020 /* Bread found us in the cache. */ #define B_VALIDSUSPWRT 0x00000040 /* Valid write during suspension. */ #define B_DELWRI 0x00000080 /* Delay I/O until buffer reused. */ -#define B_00000100 0x00000100 /* Available flag. */ +#define B_WAITING 0x00000100 /* Waiter(s) active in bwait(). */ #define B_DONE 0x00000200 /* I/O completed. */ #define B_EINTR 0x00000400 /* I/O was interrupted */ #define B_NOREUSE 0x00000800 /* Contents not reused once released. */