]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
report when zone reload already in progress
authorEvan Hunt <each@isc.org>
Wed, 13 Aug 2025 20:15:23 +0000 (13:15 -0700)
committerEvan Hunt <each@isc.org>
Fri, 17 Oct 2025 20:36:18 +0000 (20:36 +0000)
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.

bin/named/server.c
bin/tests/system/dyndb/driver/zone.c
lib/dns/include/dns/zone.h
lib/dns/zone.c
lib/dns/zt.c
lib/isc/include/isc/result.h
lib/isc/result.c

index 54c271550e2e290d4b746e3e2f8d3fc9957df105..82072750be846e3655e414ba8a8d524724a7597a 100644 (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;
                        }
index 662537a75c3a3344bf7b9c8c5d65078064991d18..9a02d4357c8f04c374b43397f65094d24a2ab350 100644 (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;
        }
index 83651ab1d9a606f7307eb26c3914df7a813bb29f..24cd59fd166058a53a470bbd30ca708a6938003e 100644 (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
index 0e66e8af180f9dd7f4122a6fd2ed8f2f1cd13046..da312739204b068714eb4bb676e93e1d8e225453 100644 (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:
index fae234ba6703e5f820b3d44e65cce8e65cc17e9c..d17c8bae22ab16b14f262db3309ec23f202bbd56 100644 (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;
                        }
index fa281b95494c7875abd1f6b51d9452f78593e761..35959812de262b501382f58c2b1ec1c763d22382 100644 (file)
 #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,
index 322928942a4d3a8a7dd3deff0ca5e94a50d2d000..a5f5de90628c3ae1cb960d99c3852af000e5ac56 100644 (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",