From 780a7c3789affbbe6a01ab695adf50817e89d2dc Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 3 Aug 2008 18:08:54 +0000 Subject: [PATCH] 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@ --- sys/kern/vfs_biomem.c | 17 +++++++++-------- 1 file 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 * @@ -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); -- 2.20.1