summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-08-03 18:08:55 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-08-03 18:08:55 +0000
commit5358e5e4bc9484bd0ee3183fd586e614ce8b8426 (patch)
tree0c2850d8714259cba338e40deb76047ea3191d92 /sys
parent81e31d58e5f2301e071fd3c88875be7497110a2c (diff)
Make buf_dealloc_mem() remove the mapping even if b_pobj is NULL. Otherwise
bread_cluster() leaks mappings which causes grief on VAC architectures. Fixes bsd.rd on hppa and armish. ok art@, beck@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_biomem.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/vfs_biomem.c b/sys/kern/vfs_biomem.c
index 57dc178533d..4ce0de770a3 100644
--- a/sys/kern/vfs_biomem.c
+++ b/sys/kern/vfs_biomem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_biomem.c,v 1.2 2008/06/11 00:11:03 thib Exp $ */
+/* $OpenBSD: vfs_biomem.c,v 1.3 2008/08/03 18:08:54 kettenis Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
*
@@ -175,21 +175,22 @@ buf_release(struct buf *bp)
int
buf_dealloc_mem(struct buf *bp)
{
- caddr_t data = bp->b_data;
+ caddr_t data;
int s;
s = splbio();
+ data = bp->b_data;
bp->b_data = NULL;
- if (bp->b_pobj) {
- if (data) {
- pmap_kremove((vaddr_t)data, bp->b_bufsize);
- pmap_update(pmap_kernel());
- }
- buf_free_pages(bp);
+ if (data) {
+ pmap_kremove((vaddr_t)data, bp->b_bufsize);
+ pmap_update(pmap_kernel());
}
+ if (bp->b_pobj)
+ buf_free_pages(bp);
+
if (data == NULL) {
splx(s);
return (0);