]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Atomic rpz shutdown 12411/head
authorAlessio Podda <alessio@isc.org>
Mon, 13 Jul 2026 15:44:48 +0000 (17:44 +0200)
committerAlessio Podda <alessio@isc.org>
Mon, 3 Aug 2026 12:31:45 +0000 (14:31 +0200)
The shutdown flag is monotonic (it always starts false, eventually
becomes true and stays that way), so it does not need mutex protection.

lib/dns/rpz.c

index 54c88de550d991d6555b2457fdaaf609501335d9..3eaaddfaee03211dd4d8ea462aee1b496a3687fa 100644 (file)
@@ -2181,11 +2181,14 @@ dns_rpz_zones_shutdown(dns_rpz_zones_t *rpzs) {
        REQUIRE(DNS_RPZ_ZONES_VALID(rpzs));
        /*
         * Forget the last of the view's rpz machinery when shutting down.
+        *
+        * shuttingdown is monotonic: it changes from false to true and is never
+        * cleared.  Publish it without taking update_lock or data_lock so
+        * workers can observe shutdown immediately.  atomic_exchange() also
+        * preserves idempotency: only the caller that changes the flag performs
+        * the per-zone shutdown work.
         */
-
-       if (!atomic_compare_exchange_strong(&rpzs->shuttingdown,
-                                           &(bool){ false }, true))
-       {
+       if (atomic_exchange(&rpzs->shuttingdown, true)) {
                return;
        }