]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2971. [bug] Fixed a bug that caused journal files not to be
authorEvan Hunt <each@isc.org>
Wed, 17 Nov 2010 00:34:23 +0000 (00:34 +0000)
committerEvan Hunt <each@isc.org>
Wed, 17 Nov 2010 00:34:23 +0000 (00:34 +0000)
compacted on Windows systems as a result of
non-POSIX-compliant rename() semantics. [RT #22434]

CHANGES
lib/dns/journal.c

diff --git a/CHANGES b/CHANGES
index e342712ee95921222f8a139bbfff121a2ee7a894..82a57c1b8ab4e5899e66d7f8e821adf2b1c87060 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+2971.  [bug]           Fixed a bug that caused journal files not to be
+                       compacted on Windows systems as a result of
+                       non-POSIX-compliant rename() semantics. [RT #22434]
+
 2970.  [security]      Adding a NO DATA negative cache entry failed to clear
                        any matching RRSIG records.  A subsequent lookup of
                        of NO DATA cache entry could trigger a INSIST when the
index 638e64755b549b133b438f089e12b3a18e761b05..3f6310867ee3bc090b7d6302ba54b5c572940e6f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: journal.c,v 1.103.48.6 2009/11/04 23:47:25 tbox Exp $ */
+/* $Id: journal.c,v 1.103.48.6.10.1 2010/11/17 00:34:23 each Exp $ */
 
 #include <config.h>
 
@@ -2173,6 +2173,12 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
 
                indexend = new->header.end.offset;
        }
+
+       /*
+        * Close both journals before trying to rename files (this is
+        * necessary on WIN32).
+        */
+       dns_journal_destroy(&j);
        dns_journal_destroy(&new);
 
        /*
@@ -2180,12 +2186,14 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
         * Any IXFR outs will just continue and the old journal will be
         * removed on final close.
         *
-        * With MSDOS / NTFS we need to do a two stage rename triggered
-        * bu EEXISTS.  Hopefully all IXFR's that were active at the last
-        * rename are now complete.
+        * With MSDOS / NTFS we need to do a two stage rename, triggered
+        * by EEXIST.  (If any IXFR's are running in other threads, however,
+        * this will fail, and the journal will not be compacted.  But
+        * if so, hopefully they'll be finished by the next time we
+        * compact.)
         */
        if (rename(newname, filename) == -1) {
-               if (errno == EACCES && !is_backup) {
+               if (errno == EEXIST && !is_backup) {
                        result = isc_file_remove(backup);
                        if (result != ISC_R_SUCCESS &&
                            result != ISC_R_FILENOTFOUND)
@@ -2202,7 +2210,6 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
                }
        }
 
-       dns_journal_destroy(&j);
        result = ISC_R_SUCCESS;
 
  failure: