From: Witold Kręcicki Date: Wed, 27 Jun 2018 12:10:04 +0000 (+0200) Subject: Fallback to normal procedure if creating of ixfr-from-differences fails X-Git-Tag: v9.9.13rc2~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=200a3fef3cedca7ce809195d06721a37ded920b0;p=thirdparty%2Fbind9.git Fallback to normal procedure if creating of ixfr-from-differences fails (cherry picked from commit b1254430df1a9795ff2afec1face7a4f5f4a78e0) (cherry picked from commit e92d5421c37d03e48d4bcd17cee950cb0e4ce24d) --- diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 58f0338af65..82df35b7b35 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -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); } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index ca1c06fda8c..85b60084981 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -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