]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2116. [bug] 'rndc reload' could cause the cache to continually
authorMark Andrews <marka@isc.org>
Thu, 7 Dec 2006 06:31:38 +0000 (06:31 +0000)
committerMark Andrews <marka@isc.org>
Thu, 7 Dec 2006 06:31:38 +0000 (06:31 +0000)
                        be cleaned. [RT #16401]

CHANGES
lib/isc/mem.c

diff --git a/CHANGES b/CHANGES
index b04ac00b2553b29d8bd5a9511e83d77cfe1c5a61..43664cfa2c9ead6d77ec968530283aa55de13eaa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2116.  [bug]           'rndc reload' could cause the cache to continually
+                       be cleaned. [RT #16401]
+
 2115.  [bug]           'rndc reconfig' could trigger a INSIST if the
                        number of masters for a zone was reduced. [RT #16444]
 
index 8d90b5867420c552dffa45282d32df6015697b8e..2ae5378af3f65697731cc5a92d1b1b0ad487618c 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: mem.c,v 1.116.18.10 2006/01/04 23:50:23 marka Exp $ */
+/* $Id: mem.c,v 1.116.18.11 2006/12/07 06:31:38 marka Exp $ */
 
 /*! \file */
 
@@ -1462,17 +1462,28 @@ void
 isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg,
                  size_t hiwater, size_t lowater)
 {
+       isc_boolean_t callwater = ISC_FALSE;
+       isc_mem_water_t oldwater;
+       void *oldwater_arg;
+
        REQUIRE(VALID_CONTEXT(ctx));
        REQUIRE(hiwater >= lowater);
 
        MCTXLOCK(ctx, &ctx->lock);
+       oldwater = ctx->water;
+       oldwater_arg = ctx->water_arg;
        if (water == NULL) {
+               callwater = ctx->hi_called;
                ctx->water = NULL;
                ctx->water_arg = NULL;
                ctx->hi_water = 0;
                ctx->lo_water = 0;
                ctx->hi_called = ISC_FALSE;
        } else {
+               if (ctx->hi_called &&
+                   (ctx->water != water || ctx->water_arg != water_arg ||
+                    ctx->inuse < lowater || lowater == 0))
+                       callwater = ISC_TRUE;
                ctx->water = water;
                ctx->water_arg = water_arg;
                ctx->hi_water = hiwater;
@@ -1480,6 +1491,9 @@ isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg,
                ctx->hi_called = ISC_FALSE;
        }
        MCTXUNLOCK(ctx, &ctx->lock);
+       
+       if (callwater && oldwater != NULL)
+               (oldwater)(oldwater_arg, ISC_MEM_LOWATER);
 }
 
 /*