From 59bfe4ee9062db2c0e3e4644ceb583fb40fa1235 Mon Sep 17 00:00:00 2001 From: Shane Kerr Date: Wed, 26 Apr 2006 12:12:07 +0000 Subject: [PATCH] Pulling rt15970 into 9.4 pre-release. --- lib/dns/acache.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/dns/acache.c b/lib/dns/acache.c index 13a0c89664c..4e319f5e6e7 100644 --- a/lib/dns/acache.c +++ b/lib/dns/acache.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: acache.c,v 1.3.2.10 2006/04/26 11:31:51 shane Exp $ */ +/* $Id: acache.c,v 1.3.2.11 2006/04/26 12:12:07 shane Exp $ */ #include @@ -1247,6 +1247,21 @@ dns_acache_createentry(dns_acache_t *acache, dns_db_t *origdb, REQUIRE(entryp != NULL && *entryp == NULL); REQUIRE(origdb != NULL); + /* + * Should we exceed our memory limit for some reason (for + * example, if the cleaner does not run aggressively enough), + * then we will not create additional entries. + * + * XXX: It might be better to lock the acache->cleaner->lock, + * but locking may be an expensive bottleneck. If we misread + * the value, we will occasionally refuse to create a few + * cache entries, or create a few that we should not. I do not + * expect this to happen often, and it will not have very bad + * effects when it does. So no lock for now. + */ + if (acache->cleaner.overmem) + return (ISC_R_NORESOURCES); + newentry = isc_mem_get(acache->mctx, sizeof(*newentry)); if (newentry == NULL) return (ISC_R_NOMEMORY); -- 2.47.3