From: Evan Hunt Date: Sat, 25 Oct 2025 00:01:14 +0000 (-0700) Subject: Remove maybe_cancel_validators() function X-Git-Tag: v9.21.16~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e62895e999e03e1e64d62c5da942b17fd15b8c75;p=thirdparty%2Fbind9.git Remove maybe_cancel_validators() function When shutting down an fctx, validators can just be canceled without checking whether there are pending finds. --- diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 85019613fb1..091481a3e37 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -669,8 +669,6 @@ negcache(dns_message_t *message, fetchctx_t *fctx, const dns_name_t *name, static void validated(void *arg); static void -maybe_cancel_validators(fetchctx_t *fctx); -static void add_bad(fetchctx_t *fctx, dns_message_t *rmessage, dns_adbaddrinfo_t *addrinfo, isc_result_t reason, badnstype_t badtype); static void @@ -1745,11 +1743,11 @@ fctx__done(fetchctx_t *fctx, isc_result_t result, const char *func, fctx_stoptimer(fctx); /* - * Cancel all pending validators. Note that this must be done - * without the fctx lock held, since that could cause - * deadlock. + * Cancel all pending validators. */ - maybe_cancel_validators(fctx); + ISC_LIST_FOREACH(fctx->validators, validator, link) { + dns_validator_cancel(validator); + } if (fctx->nsfetch != NULL) { dns_resolver_cancelfetch(fctx->nsfetch); @@ -5119,28 +5117,6 @@ clone_results(fetchctx_t *fctx) { #define CHASE(r) (((r)->attributes.chase)) #define CHECKNAMES(r) (((r)->attributes.checknames)) -/* - * Cancel validators associated with '*fctx' if it is ready to be - * destroyed (i.e., no queries waiting for it and no pending ADB finds). - * Caller must hold fctx bucket lock. - * - * Requires: - * '*fctx' is shutting down. - */ -static void -maybe_cancel_validators(fetchctx_t *fctx) { - if (atomic_load_acquire(&fctx->pending) != 0 || - atomic_load_acquire(&fctx->nqueries) != 0) - { - return; - } - - REQUIRE(SHUTTINGDOWN(fctx)); - ISC_LIST_FOREACH(fctx->validators, validator, link) { - dns_validator_cancel(validator); - } -} - /* * typemap with just RRSIG(46) and NSEC(47) bits set. *