]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't skip the counting if fcount_incr() is called with force==true
authorOndřej Surý <ondrej@isc.org>
Thu, 20 Jun 2024 16:59:56 +0000 (18:59 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 5 Aug 2024 07:33:20 +0000 (07:33 +0000)
The fcount_incr() was incorrectly skipping the accounting for the
fetches-per-zone if the force argument was set to true.  We want to skip
the accounting only when the fetches-per-zone is completely disabled,
but for individual names we need to do the accounting even if we are
forcing the result to be success.

lib/dns/resolver.c

index 382a4e98aa351fbe03f24e7e54275bd6126fe39f..ef333d50cefd690af6024da61d3f4a012dcdc12f 100644 (file)
@@ -1439,8 +1439,9 @@ fcount_incr(fetchctx_t *fctx, bool force) {
        REQUIRE(res != NULL);
        INSIST(fctx->counter == NULL);
 
+       /* Skip any counting if fetches-per-zone is disabled */
        spill = atomic_load_acquire(&res->zspill);
-       if (force || spill == 0) {
+       if (spill == 0) {
                return (ISC_R_SUCCESS);
        }
 
@@ -1486,7 +1487,7 @@ fcount_incr(fetchctx_t *fctx, bool force) {
 
        INSIST(spill > 0);
        LOCK(&counter->lock);
-       if (++counter->count > spill) {
+       if (!force && ++counter->count > spill) {
                counter->count--;
                INSIST(counter->count > 0);
                counter->dropped++;