]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Restore dns_requestmgr_shutdown re-entrancy
authorMark Andrews <marka@isc.org>
Thu, 18 Jan 2024 02:43:30 +0000 (13:43 +1100)
committerMark Andrews <marka@isc.org>
Tue, 6 Feb 2024 22:52:32 +0000 (09:52 +1100)
In the conversion to rcu the ability to call dns_requestmgr_shutdown
multiple times was lost.  nsupdate depended on this.  Restore support
for that.

lib/dns/request.c

index 14a96058c2ab8a311fca4f9029b9d83f19a73416..400cfe04f503cd77bd3e296ec4960499f74b726c 100644 (file)
@@ -190,15 +190,20 @@ requests_shutdown(void *arg) {
 
 void
 dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr) {
+       bool first;
        REQUIRE(VALID_REQUESTMGR(requestmgr));
 
        req_log(ISC_LOG_DEBUG(3), "%s: %p", __func__, requestmgr);
 
        rcu_read_lock();
-       INSIST(atomic_compare_exchange_strong(&requestmgr->shuttingdown,
-                                             &(bool){ false }, true));
+       first = atomic_compare_exchange_strong(&requestmgr->shuttingdown,
+                                              &(bool){ false }, true);
        rcu_read_unlock();
 
+       if (!first) {
+               return;
+       }
+
        /*
         * Wait until all dns_request_create{raw}() are finished, so
         * there will be no new requests added to the lists.