diff options
author | 2008-06-14 00:49:35 +0000 | |
---|---|---|
committer | 2008-06-14 00:49:35 +0000 | |
commit | 0a7d1314561b1005eb883c307ae2f61e805c4841 (patch) | |
tree | d39b50561148081d483e69927151b30e79aa00c3 | |
parent | Fixed wrong function name in fatal call. (diff) | |
download | wireguard-openbsd-0a7d1314561b1005eb883c307ae2f61e805c4841.tar.xz wireguard-openbsd-0a7d1314561b1005eb883c307ae2f61e805c4841.zip |
Belt, suspenders, duct tape and glue.
In brelse, if we end up in the B_INVAL case without mappings, check
for B_WANTED and wake up the sleeper if there's one before freeing the
buffer. This shouldn't happen, but it looks like there might actually
be some dodgy corner cases in nfs where this could just happen if the
phase of the moon is right and the wind is blowing from the right
direction.
thib@ ok
-rw-r--r-- | sys/kern/vfs_bio.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index ee1b43b0221..29849bf5312 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.106 2008/06/12 06:58:39 deraadt Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.107 2008/06/14 00:49:35 art Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -773,6 +773,17 @@ brelse(struct buf *bp) * pool. */ if (bp->b_data == NULL && bp->b_pobj == NULL) { + /* + * Wake up any processes waiting for _this_ buffer to + * become free. They are not allowed to grab it + * since it will be freed. But the only sleeper is + * getblk and it's restarting the operation after + * sleep. + */ + if (ISSET(bp->b_flags, B_WANTED)) { + CLR(bp->b_flags, B_WANTED); + wakeup(bp); + } buf_put(bp); splx(s); return; |