]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Flush the new journal at very end in dns_journal_compact()
authorOndřej Surý <ondrej@isc.org>
Thu, 6 Apr 2023 09:42:20 +0000 (11:42 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 27 Nov 2024 17:55:33 +0000 (18:55 +0100)
When compacting journal, we don't need to flush/fsync the new journal
continuously, but only at the very end before we close and rename the
journal.

Closes: #3556
lib/dns/journal.c

index cd99afdcb492e550a9cdf8d260689ffe7ec5b02c..f4e1758e9f94246015e8b580fa0bcbe3fd53d13c 100644 (file)
@@ -2751,15 +2751,12 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
                        j2->header.end.offset = indexend + len;
                }
 
-               CHECK(journal_fsync(j2));
-
                /*
                 * Update the journal header.
                 */
                journal_header_encode(&j2->header, &rawheader);
                CHECK(journal_seek(j2, 0));
                CHECK(journal_write(j2, &rawheader, sizeof(rawheader)));
-               CHECK(journal_fsync(j2));
 
                /*
                 * Build new index.
@@ -2774,12 +2771,13 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
                 * Write index.
                 */
                CHECK(index_to_disk(j2));
-               CHECK(journal_fsync(j2));
 
                indexend = j2->header.end.offset;
                POST(indexend);
        }
 
+       CHECK(journal_fsync(j2));
+
        /*
         * Close both journals before trying to rename files.
         */