summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/db/hash/hash_buf.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c
index 2d31534305e..0b864af82e3 100644
--- a/lib/libc/db/hash/hash_buf.c
+++ b/lib/libc/db/hash/hash_buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hash_buf.c,v 1.16 2005/08/05 13:03:00 espie Exp $ */
+/* $OpenBSD: hash_buf.c,v 1.17 2008/10/01 19:56:57 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -169,6 +169,21 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
bp = LRU;
}
+ /* If prev_bp is part of bp overflow, create a new buffer. */
+ if (hashp->nbufs == 0 && (prev_bp && bp->ovfl)) {
+ BUFHEAD *ovfl_head, *ovfl_next;
+
+ ovfl_head = bp->ovfl;
+ ovfl_next = ovfl_head;
+ while (ovfl_next) {
+ if (ovfl_next == prev_bp) {
+ hashp->nbufs++;
+ break;
+ }
+ ovfl_next = ovfl_next->ovfl;
+ }
+ }
+
/*
* If LRU buffer is pinned, the buffer pool is too small. We need to
* allocate more buffers.