diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 4f98f38a6a..c9bca4bd94 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -11063,6 +11063,7 @@ zone_maintenance(dns_zone_t *zone) { isc_time_t now; isc_result_t result; bool dumping, load_pending, viewok; + bool need_notify; REQUIRE(DNS_ZONE_VALID(zone)); ENTER; @@ -11147,11 +11148,15 @@ zone_maintenance(dns_zone_t *zone) { * Secondaries send notifies before backing up to disk, * primaries after. */ - if ((zone->type == dns_zone_slave || zone->type == dns_zone_mirror) && - (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) || - DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY)) && - isc_time_compare(&now, &zone->notifytime) >= 0) - { + LOCK_ZONE(zone); + need_notify = (zone->type == dns_zone_slave || + zone->type == dns_zone_mirror) && + (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) || + DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY)) && + (isc_time_compare(&now, &zone->notifytime) >= 0); + UNLOCK_ZONE(zone); + + if (need_notify) { zone_notify(zone, &now); }