summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2006-10-02 02:06:27 +0000
committertegge <tegge@FreeBSD.org>2006-10-02 02:06:27 +0000
commit4d26d3d4d7b97a3bbb360a06b061e0af9728920f (patch)
treee5d5e1e8f49a36219f541a75afc21293e49757cd /sys/kern/vfs_bio.c
parentc12a3c74f93c0808b4c8f0664df6c80b08a2f570 (diff)
downloadFreeBSD-src-4d26d3d4d7b97a3bbb360a06b061e0af9728920f.zip
FreeBSD-src-4d26d3d4d7b97a3bbb360a06b061e0af9728920f.tar.gz
If the buffer lock has waiters after the buffer has changed identity then
getnewbuf() needs to drop the buffer in order to wake waiters that might sleep on the buffer in the context of the old identity.
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 37ef552..904e84c 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1890,6 +1890,17 @@ restart:
}
/*
+ * Notify any waiters for the buffer lock about
+ * identity change by freeing the buffer.
+ */
+ if (qindex == QUEUE_CLEAN && BUF_LOCKWAITERS(bp) > 0) {
+ bp->b_flags |= B_INVAL;
+ bfreekva(bp);
+ brelse(bp);
+ goto restart;
+ }
+
+ /*
* If we are overcomitted then recover the buffer and its
* KVM space. This occurs in rare situations when multiple
* processes are blocked in getnewbuf() or allocbuf().
OpenPOWER on IntegriCloud