report when zone reload already in progress

if a zone reload is already in progress when 'rndc reload <zone>' 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.
This commit is contained in:
Evan Hunt 2025-08-13 13:15:23 -07:00
parent 82a150adca
commit 43f53b5010
7 changed files with 91 additions and 78 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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:

View file

@ -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;
}

View file

@ -18,74 +18,73 @@
#include <inttypes.h>
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,

View file

@ -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",