mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-12 05:32:42 -04:00
Do not recheck DNS_ZONEFLG_LOADPENDING in zone_asyncload()
Remove a block of code which dates back to commit 8a2ab2b920, when
dns_zone_asyncload() did not yet check DNS_ZONEFLG_LOADPENDING.
Currently, no race in accessing DNS_ZONEFLG_LOADPENDING is possible any
more, because:
- dns_zone_asyncload() is still the only function which may queue
zone_asyncload(),
- dns_zone_asyncload() accesses DNS_ZONEFLG_LOADPENDING under a lock
(and potentially queues an event under the same lock),
- DNS_ZONEFLG_LOADPENDING is not cleared until the load actually
completes.
Thus, the rechecking code can be safely removed from zone_asyncload().
Note that this also brings zone_asyncload() to a state in which the
completion callback is always invoked. This is required to prevent
leaking memory in case something goes wrong in zone_asyncload() and a
zone table the zone belongs to is indefinitely left with a positive
reference count.
This commit is contained in:
parent
4d391101a4
commit
5c080dfe73
1 changed files with 0 additions and 11 deletions
|
|
@ -2167,7 +2167,6 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
|
|||
dns_asyncload_t *asl = event->ev_arg;
|
||||
dns_zone_t *zone = asl->zone;
|
||||
isc_result_t result;
|
||||
isc_boolean_t load_pending;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
|
|
@ -2175,17 +2174,8 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
|
|||
|
||||
isc_event_free(&event);
|
||||
|
||||
/* Make sure load is still pending */
|
||||
LOCK_ZONE(zone);
|
||||
load_pending = ISC_TF(DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADPENDING));
|
||||
|
||||
if (!load_pending) {
|
||||
UNLOCK_ZONE(zone);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = zone_load(zone, 0, ISC_TRUE);
|
||||
|
||||
if (result != DNS_R_CONTINUE) {
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADPENDING);
|
||||
}
|
||||
|
|
@ -2195,7 +2185,6 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
|
|||
if (asl->loaded != NULL)
|
||||
(asl->loaded)(asl->loaded_arg, zone, task);
|
||||
|
||||
cleanup:
|
||||
isc_mem_put(zone->mctx, asl, sizeof (*asl));
|
||||
dns_zone_idetach(&zone);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue