From: Alessio Podda Date: Mon, 13 Jul 2026 15:44:48 +0000 (+0200) Subject: Atomic rpz shutdown X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c94e199f0440e7ad1e3a2e7c957a8e6fdd1d626d;p=thirdparty%2Fbind9.git Atomic rpz shutdown The shutdown flag is monotonic (it always starts false, eventually becomes true and stays that way), so it does not need mutex protection. --- diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 54c88de550d..3eaaddfaee0 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -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; }