]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Lock zone to read DNS_ZONEFLG_DIALREFRESH
authorMark Andrews <marka@isc.org>
Mon, 31 Aug 2020 12:32:14 +0000 (22:32 +1000)
committerMark Andrews <marka@isc.org>
Tue, 8 Sep 2020 07:41:33 +0000 (17:41 +1000)
lib/dns/zone.c

index 4af5606d1e52ee750a954ad22aa36382cd4a6164..df4c367d635efeb44bd400ab60d1470a12dbef55 100644 (file)
@@ -10138,7 +10138,7 @@ zone_maintenance(dns_zone_t *zone) {
        const char me[] = "zone_maintenance";
        isc_time_t now;
        isc_result_t result;
-       bool dumping, load_pending, viewok;
+       bool dumping, load_pending, viewok, start_refresh;
 
        REQUIRE(DNS_ZONE_VALID(zone));
        ENTER;
@@ -10202,9 +10202,16 @@ zone_maintenance(dns_zone_t *zone) {
                /* FALLTHROUGH */
        case dns_zone_slave:
        case dns_zone_stub:
+               start_refresh = false;
+               LOCK_ZONE(zone);
                if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DIALREFRESH) &&
-                   isc_time_compare(&now, &zone->refreshtime) >= 0)
+                   isc_time_compare(&now, &zone->refreshtime) >= 0) {
+                       start_refresh = true;
+               }
+               UNLOCK_ZONE(zone);
+               if (start_refresh) {
                        dns_zone_refresh(zone);
+               }
                break;
        default:
                break;