]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fallback to normal procedure if creating of ixfr-from-differences fails
authorWitold Kręcicki <wpk@isc.org>
Wed, 27 Jun 2018 12:10:04 +0000 (14:10 +0200)
committerEvan Hunt <each@isc.org>
Thu, 28 Jun 2018 02:36:47 +0000 (19:36 -0700)
(cherry picked from commit b1254430df1a9795ff2afec1face7a4f5f4a78e0)
(cherry picked from commit e92d5421c37d03e48d4bcd17cee950cb0e4ce24d)

lib/dns/journal.c
lib/dns/zone.c

index 58f0338af65a98d95ca64f18d782b2210293347c..82df35b7b355bb9433bc6fe084d2e4f5619a95db 100644 (file)
@@ -1013,7 +1013,7 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
        dns_difftuple_t *t;
        isc_buffer_t buffer;
        void *mem = NULL;
-       size_t size;
+       isc_uint64_t size;
        isc_result_t result;
        isc_region_t used;
 
@@ -1044,7 +1044,11 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
        }
 
        if (size >= DNS_JOURNAL_SIZE_MAX) {
-               return (ISC_R_RANGE);
+               isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
+                             "dns_journal_writediff: %s: journal entry "
+                             "too big to be stored: %llu bytes", j->filename,
+                             size);
+               return (ISC_R_NOSPACE);
        }
 
        mem = isc_mem_get(j->mctx, size);
@@ -1100,6 +1104,7 @@ isc_result_t
 dns_journal_commit(dns_journal_t *j) {
        isc_result_t result;
        journal_rawheader_t rawheader;
+       isc_uint64_t total;
 
        REQUIRE(DNS_JOURNAL_VALID(j));
        REQUIRE(j->state == JOURNAL_STATE_TRANSACTION ||
@@ -1152,12 +1157,12 @@ dns_journal_commit(dns_journal_t *j) {
        /*
         * We currently don't support huge journal entries.
         */
-       unsigned long long total = j->x.pos[1].offset - j->x.pos[0].offset;
+       total = j->x.pos[1].offset - j->x.pos[0].offset;
        if (total >= DNS_JOURNAL_SIZE_MAX) {
                isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                            "transaction too big to be stored in journal :"
+                            "transaction too big to be stored in journal"
                             "%llub (max is %llub)", total,
-                            (unsigned long long)DNS_JOURNAL_SIZE_MAX);
+                            (isc_uint64_t)DNS_JOURNAL_SIZE_MAX);
                return (ISC_R_UNEXPECTED);
        }
 
index ca1c06fda8cbe7c6048e57f89272487067242f57..85b60084981b699a6667fc9acddac24fa1a2adb5 100644 (file)
@@ -14281,15 +14281,14 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
 
                result = dns_db_diff(zone->mctx, db, ver, zone->db, NULL,
                                     zone->journal);
-               if (result == ISC_R_RANGE) {
+               if (result != ISC_R_SUCCESS) {
+                       char strbuf[ISC_STRERRORSIZE];
+                       isc__strerror(errno, strbuf, sizeof(strbuf));
                        dns_zone_log(zone, ISC_LOG_ERROR,
                                     "ixfr-from-differences: failed: "
-                                    "difference too big to be stored "
-                                    "in journal");
-                       goto fail;
+                                    "%s", strbuf);
+                       goto fallback;
                }
-               if (result != ISC_R_SUCCESS)
-                       goto fail;
                if (dump)
                        zone_needdump(zone, DNS_DUMP_DELAY);
                else if (zone->journalsize != -1) {
@@ -14313,6 +14312,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
                if (zone->type == dns_zone_master && inline_raw(zone))
                        zone_send_secureserial(zone, serial);
        } else {
+ fallback:
                if (dump && zone->masterfile != NULL) {
                        /*
                         * If DNS_ZONEFLG_FORCEXFER was set we don't want