summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-12-01 19:04:00 +0000
committerdyson <dyson@FreeBSD.org>1997-12-01 19:04:00 +0000
commitded4973e92fbb293864f4b990c9e9f2939f80cfd (patch)
tree6e48de566417215f3d5e796f6660b1fbad995022
parentba00c38faa8954b1525941befa35bf9312aedb85 (diff)
downloadFreeBSD-src-ded4973e92fbb293864f4b990c9e9f2939f80cfd.zip
FreeBSD-src-ded4973e92fbb293864f4b990c9e9f2939f80cfd.tar.gz
Fix a serious problem during resizing buffers where old buffers
address space wasn't being properly reclaimed. Submitted by: Bruce Evans <bde@freebsd.org>
-rw-r--r--sys/kern/vfs_bio.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 1361d43..8c4c9ca 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.134 1997/11/07 08:53:04 phk Exp $
+ * $Id: vfs_bio.c,v 1.135 1997/11/24 06:18:27 dyson Exp $
*/
/*
@@ -901,7 +901,7 @@ vfs_bio_awrite(struct buf * bp)
static struct buf *
getnewbuf(struct vnode *vp, int slpflag, int slptimeo, int size, int maxsize)
{
- struct buf *bp;
+ struct buf *bp, *bp1;
int nbyteswritten = 0;
vm_offset_t addr;
static int writerecursion = 0;
@@ -1059,11 +1059,20 @@ fillbuf:
if (maxsize != bp->b_kvasize) {
bfreekva(bp);
+findkvaspace:
/*
* See if we have buffer kva space
*/
if (vm_map_findspace(buffer_map,
vm_map_min(buffer_map), maxsize, &addr)) {
+ for (bp1 = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]);
+ bp1 != NULL; bp1 = TAILQ_NEXT(bp1, b_freelist))
+ if (bp1->b_kvasize != 0) {
+ bremfree(bp1);
+ bfreekva(bp1);
+ brelse(bp1);
+ goto findkvaspace;
+ }
bp->b_flags |= B_INVAL;
brelse(bp);
goto trytofreespace;
OpenPOWER on IntegriCloud