From: Evan Hunt Date: Wed, 13 Aug 2025 20:15:23 +0000 (-0700) Subject: report when zone reload already in progress X-Git-Tag: v9.21.15~58^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43f53b501081feadcbfc171b86a02cf2f38e4e97;p=thirdparty%2Fbind9.git report when zone reload already in progress if a zone reload is already in progress when 'rndc reload ' is run, currently the message returned in "zone reload queued", which is correct, but it's identical to the message returned when a reload was *not* in progress, so the user can't easily tell what happened. a user could reload a zone twice and not realize that only one reload actually took place. this has been addressed by changing the message returned to "zone reload was already queued". a new result code ISC_R_LOADING has been added to signal this condition, taking the place of ISC_R_RELOAD, which was obsolete and has been removed. --- diff --git a/bin/named/server.c b/bin/named/server.c index 54c271550e2..82072750be8 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -9458,7 +9458,7 @@ load_zones(named_server_t *server, bool reconfig) { result = dns_zone_load(view->managed_keys, false); if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE && - result != DNS_R_CONTINUE) + result != ISC_R_LOADING && result != DNS_R_CONTINUE) { goto cleanup; } @@ -9467,7 +9467,7 @@ load_zones(named_server_t *server, bool reconfig) { result = dns_zone_load(view->redirect, false); if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE && - result != DNS_R_CONTINUE) + result != ISC_R_LOADING && result != DNS_R_CONTINUE) { goto cleanup; } @@ -10475,6 +10475,10 @@ named_server_reloadcommand(named_server_t *server, isc_lex_t *lex, msg = "zone reload queued"; result = ISC_R_SUCCESS; break; + case ISC_R_LOADING: + msg = "zone reload was already queued"; + result = ISC_R_SUCCESS; + break; case DNS_R_UPTODATE: msg = "zone reload up-to-date"; result = ISC_R_SUCCESS; @@ -12350,6 +12354,12 @@ named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex, "Check the logs to see the result."; result = ISC_R_SUCCESS; break; + case ISC_R_LOADING: + msg = "A zone reload and thaw was already " + "in progress.\nCheck the logs to see " + "the result."; + result = ISC_R_SUCCESS; + break; default: break; } diff --git a/bin/tests/system/dyndb/driver/zone.c b/bin/tests/system/dyndb/driver/zone.c index 662537a75c3..9a02d4357c8 100644 --- a/bin/tests/system/dyndb/driver/zone.c +++ b/bin/tests/system/dyndb/driver/zone.c @@ -197,7 +197,8 @@ load_zone(dns_zone_t *zone) { result = dns_zone_load(zone, false); if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE && - result != DNS_R_DYNAMIC && result != DNS_R_CONTINUE) + result != DNS_R_DYNAMIC && result != ISC_R_LOADING && + result != DNS_R_CONTINUE) { goto cleanup; } diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 83651ab1d9a..24cd59fd166 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -457,6 +457,7 @@ dns_zone_loadandthaw(dns_zone_t *zone); *\li #ISC_R_UNEXPECTED *\li #ISC_R_SUCCESS *\li DNS_R_CONTINUE Incremental load has been queued. + *\li ISC_R_LOADING Load was already in progress. *\li DNS_R_UPTODATE The zone has already been loaded based on * file system timestamps. *\li DNS_R_BADZONE diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 0e66e8af180..da312739204 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -2434,11 +2434,12 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) { INSIST(zone->type != dns_zone_none); + /* load was already in progress */ if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADING)) { if ((flags & DNS_ZONELOADFLAG_THAW) != 0) { DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_THAW); } - result = DNS_R_CONTINUE; + result = ISC_R_LOADING; goto cleanup; } @@ -2705,7 +2706,7 @@ zone_asyncload(void *arg) { LOCK_ZONE(zone); result = zone_load(zone, asl->flags, true); - if (result != DNS_R_CONTINUE) { + if (result != DNS_R_CONTINUE && result != ISC_R_LOADING) { DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADPENDING); } UNLOCK_ZONE(zone); @@ -2779,6 +2780,7 @@ dns_zone_loadandthaw(dns_zone_t *zone) { switch (result) { case DNS_R_CONTINUE: + case ISC_R_LOADING: /* Deferred thaw. */ break; case DNS_R_UPTODATE: diff --git a/lib/dns/zt.c b/lib/dns/zt.c index fae234ba670..d17c8bae22a 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -286,8 +286,8 @@ static isc_result_t load(dns_zone_t *zone, void *uap) { isc_result_t result; result = dns_zone_load(zone, uap != NULL); - if (result == DNS_R_CONTINUE || result == DNS_R_UPTODATE || - result == DNS_R_DYNAMIC) + if (result == DNS_R_CONTINUE || result == ISC_R_LOADING || + result == DNS_R_UPTODATE || result == DNS_R_DYNAMIC) { result = ISC_R_SUCCESS; } @@ -448,7 +448,7 @@ freezezones(dns_zone_t *zone, void *uap) { if (frozen) { result = dns_zone_loadandthaw(zone); if (result == DNS_R_CONTINUE || - result == DNS_R_UPTODATE) + result == ISC_R_LOADING || result == DNS_R_UPTODATE) { result = ISC_R_SUCCESS; } diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index fa281b95494..35959812de2 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -18,74 +18,73 @@ #include typedef enum isc_result { - ISC_R_SUCCESS, /*%< success */ - ISC_R_NOMEMORY, /*%< out of memory */ - ISC_R_TIMEDOUT, /*%< timed out */ - ISC_R_ADDRNOTAVAIL, /*%< address not available */ - ISC_R_ADDRINUSE, /*%< address in use */ - ISC_R_NOPERM, /*%< permission denied */ - ISC_R_NOCONN, /*%< no pending connections */ - ISC_R_NETUNREACH, /*%< network unreachable */ - ISC_R_HOSTUNREACH, /*%< host unreachable */ - ISC_R_NETDOWN, /*%< network down */ - ISC_R_HOSTDOWN, /*%< host down */ - ISC_R_CONNREFUSED, /*%< connection refused */ - ISC_R_NORESOURCES, /*%< not enough free resources */ - ISC_R_EOF, /*%< end of file */ - ISC_R_RELOAD, /*%< reload */ - ISC_R_SUSPEND = ISC_R_RELOAD, /*%< alias of 'reload' */ - ISC_R_LOCKBUSY, /*%< lock busy */ - ISC_R_EXISTS, /*%< already exists */ - ISC_R_NOSPACE, /*%< ran out of space */ - ISC_R_CANCELED, /*%< operation canceled */ - ISC_R_SHUTTINGDOWN, /*%< shutting down */ - ISC_R_NOTFOUND, /*%< not found */ - ISC_R_UNEXPECTEDEND, /*%< unexpected end of input */ - ISC_R_FAILURE, /*%< generic failure */ - ISC_R_IOERROR, /*%< I/O error */ - ISC_R_NOTIMPLEMENTED, /*%< not implemented */ - ISC_R_UNBALANCED, /*%< unbalanced parentheses */ - ISC_R_NOMORE, /*%< no more */ - ISC_R_INVALIDFILE, /*%< invalid file */ - ISC_R_BADBASE64, /*%< bad base64 encoding */ - ISC_R_UNEXPECTEDTOKEN, /*%< unexpected token */ - ISC_R_QUOTA, /*%< quota reached */ - ISC_R_UNEXPECTED, /*%< unexpected error */ - ISC_R_ALREADYRUNNING, /*%< already running */ - ISC_R_IGNORE, /*%< ignore */ - ISC_R_MASKNONCONTIG, /*%< addr mask not contiguous */ - ISC_R_FILENOTFOUND, /*%< file not found */ - ISC_R_FILEEXISTS, /*%< file already exists */ - ISC_R_NOTCONNECTED, /*%< socket is not connected */ - ISC_R_RANGE, /*%< out of range */ - ISC_R_NOENTROPY, /*%< out of entropy */ - ISC_R_MULTICAST, /*%< invalid use of multicast */ - ISC_R_NOTFILE, /*%< not a file */ - ISC_R_FAMILYMISMATCH, /*%< address family mismatch */ - ISC_R_FAMILYNOSUPPORT, /*%< AF not supported */ - ISC_R_BADHEX, /*%< bad hex encoding */ - ISC_R_TOOMANYOPENFILES, /*%< too many open files */ - ISC_R_UNBALANCEDQUOTES, /*%< unbalanced quotes */ - ISC_R_CONNECTIONRESET, /*%< connection reset */ - ISC_R_SOFTQUOTA, /*%< soft quota reached */ - ISC_R_BADNUMBER, /*%< not a valid number */ - ISC_R_DISABLED, /*%< disabled */ - ISC_R_MAXSIZE, /*%< max size */ - ISC_R_BADADDRESSFORM, /*%< invalid address format */ - ISC_R_BADBASE32, /*%< bad base32 encoding */ - ISC_R_UNSET, /*%< unset */ - ISC_R_MULTIPLE, /*%< multiple */ - ISC_R_COMPLETE, /*%< complete */ - ISC_R_CRYPTOFAILURE, /*%< cryptography library failure */ - ISC_R_DISCQUOTA, /*%< disc quota */ - ISC_R_DISCFULL, /*%< disc full */ - ISC_R_DEFAULT, /*%< default */ - ISC_R_IPV4PREFIX, /*%< IPv4 prefix */ - ISC_R_TLSERROR, /*%< TLS error */ - ISC_R_TLSBADPEERCERT, /*%< TLS peer certificate verification failed */ - ISC_R_HTTP2ALPNERROR, /*%< ALPN for HTTP/2 failed */ - ISC_R_DOTALPNERROR, /*%< ALPN for DoT failed */ - ISC_R_INVALIDPROTO, /*%< invalid protocol */ + ISC_R_SUCCESS, /*%< success */ + ISC_R_NOMEMORY, /*%< out of memory */ + ISC_R_TIMEDOUT, /*%< timed out */ + ISC_R_ADDRNOTAVAIL, /*%< address not available */ + ISC_R_ADDRINUSE, /*%< address in use */ + ISC_R_NOPERM, /*%< permission denied */ + ISC_R_NOCONN, /*%< no pending connections */ + ISC_R_NETUNREACH, /*%< network unreachable */ + ISC_R_HOSTUNREACH, /*%< host unreachable */ + ISC_R_NETDOWN, /*%< network down */ + ISC_R_HOSTDOWN, /*%< host down */ + ISC_R_CONNREFUSED, /*%< connection refused */ + ISC_R_NORESOURCES, /*%< not enough free resources */ + ISC_R_EOF, /*%< end of file */ + ISC_R_LOADING, /*%< loading */ + ISC_R_LOCKBUSY, /*%< lock busy */ + ISC_R_EXISTS, /*%< already exists */ + ISC_R_NOSPACE, /*%< ran out of space */ + ISC_R_CANCELED, /*%< operation canceled */ + ISC_R_SHUTTINGDOWN, /*%< shutting down */ + ISC_R_NOTFOUND, /*%< not found */ + ISC_R_UNEXPECTEDEND, /*%< unexpected end of input */ + ISC_R_FAILURE, /*%< generic failure */ + ISC_R_IOERROR, /*%< I/O error */ + ISC_R_NOTIMPLEMENTED, /*%< not implemented */ + ISC_R_UNBALANCED, /*%< unbalanced parentheses */ + ISC_R_NOMORE, /*%< no more */ + ISC_R_INVALIDFILE, /*%< invalid file */ + ISC_R_BADBASE64, /*%< bad base64 encoding */ + ISC_R_UNEXPECTEDTOKEN, /*%< unexpected token */ + ISC_R_QUOTA, /*%< quota reached */ + ISC_R_UNEXPECTED, /*%< unexpected error */ + ISC_R_ALREADYRUNNING, /*%< already running */ + ISC_R_IGNORE, /*%< ignore */ + ISC_R_MASKNONCONTIG, /*%< addr mask not contiguous */ + ISC_R_FILENOTFOUND, /*%< file not found */ + ISC_R_FILEEXISTS, /*%< file already exists */ + ISC_R_NOTCONNECTED, /*%< socket is not connected */ + ISC_R_RANGE, /*%< out of range */ + ISC_R_NOENTROPY, /*%< out of entropy */ + ISC_R_MULTICAST, /*%< invalid use of multicast */ + ISC_R_NOTFILE, /*%< not a file */ + ISC_R_FAMILYMISMATCH, /*%< address family mismatch */ + ISC_R_FAMILYNOSUPPORT, /*%< AF not supported */ + ISC_R_BADHEX, /*%< bad hex encoding */ + ISC_R_TOOMANYOPENFILES, /*%< too many open files */ + ISC_R_UNBALANCEDQUOTES, /*%< unbalanced quotes */ + ISC_R_CONNECTIONRESET, /*%< connection reset */ + ISC_R_SOFTQUOTA, /*%< soft quota reached */ + ISC_R_BADNUMBER, /*%< not a valid number */ + ISC_R_DISABLED, /*%< disabled */ + ISC_R_MAXSIZE, /*%< max size */ + ISC_R_BADADDRESSFORM, /*%< invalid address format */ + ISC_R_BADBASE32, /*%< bad base32 encoding */ + ISC_R_UNSET, /*%< unset */ + ISC_R_MULTIPLE, /*%< multiple */ + ISC_R_COMPLETE, /*%< complete */ + ISC_R_CRYPTOFAILURE, /*%< cryptography library failure */ + ISC_R_DISCQUOTA, /*%< disc quota */ + ISC_R_DISCFULL, /*%< disc full */ + ISC_R_DEFAULT, /*%< default */ + ISC_R_IPV4PREFIX, /*%< IPv4 prefix */ + ISC_R_TLSERROR, /*%< TLS error */ + ISC_R_TLSBADPEERCERT, /*%< TLS peer certificate verification failed */ + ISC_R_HTTP2ALPNERROR, /*%< ALPN for HTTP/2 failed */ + ISC_R_DOTALPNERROR, /*%< ALPN for DoT failed */ + ISC_R_INVALIDPROTO, /*%< invalid protocol */ DNS_R_LABELTOOLONG, DNS_R_BADESCAPE, diff --git a/lib/isc/result.c b/lib/isc/result.c index 322928942a4..a5f5de90628 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -34,7 +34,7 @@ static const char *description[ISC_R_NRESULTS] = { [ISC_R_CONNREFUSED] = "connection refused", [ISC_R_NORESOURCES] = "not enough free resources", [ISC_R_EOF] = "end of file", - [ISC_R_RELOAD] = "reload", + [ISC_R_LOADING] = "loading", [ISC_R_LOCKBUSY] = "lock busy", [ISC_R_EXISTS] = "already exists", [ISC_R_NOSPACE] = "ran out of space", @@ -268,7 +268,7 @@ static const char *identifier[ISC_R_NRESULTS] = { [ISC_R_CONNREFUSED] = "ISC_R_CONNREFUSED", [ISC_R_NORESOURCES] = "ISC_R_NORESOURCES", [ISC_R_EOF] = "ISC_R_EOF", - [ISC_R_RELOAD] = "ISC_R_RELOAD", + [ISC_R_LOADING] = "ISC_R_LOADING", [ISC_R_LOCKBUSY] = "ISC_R_LOCKBUSY", [ISC_R_EXISTS] = "ISC_R_EXISTS", [ISC_R_NOSPACE] = "ISC_R_NOSPACE",