Deal with maildir quota file races.
authorPhil Pennock <pdp@exim.org>
Mon, 21 Feb 2011 05:38:07 +0000 (00:38 -0500)
committerPhil Pennock <pdp@exim.org>
Mon, 21 Feb 2011 05:39:09 +0000 (00:39 -0500)
Based on patch from Heiko Schlittermann.
Fixes bug 1086.

doc/doc-txt/ChangeLog
src/src/transports/appendfile.c
src/src/transports/tf_maildir.c

index 1fb19caee96f852b924e730acd960a5704b1a048..3764a88a1e8432ba616a3184d29a30d9a7e2fdda 100644 (file)
@@ -66,6 +66,9 @@ PP/11 Bugzilla 1055: Update $message_linecount for maildir_tag.
 PP/12 Bugzilla 1056: Improved spamd server selection.
       Patch from Mark Zealey.
 
+PP/13 Bugzilla 1086: Deal with maildir quota file races.
+      Based on patch from Heiko Schlittermann.
+
 
 Exim version 4.74
 -----------------
index 6dbb352629dd511f114526327a3907f147a846a3..e5ab657653f45a39dfabb7837aff4d4a4c3d19df 100644 (file)
@@ -2419,9 +2419,18 @@ else
           "%s/maildirsize", check_path);
         return FALSE;
         }
+      else if (maildirsize_fd == -2)
+        {
+        DEBUG(D_transport) debug_printf("disabling quota check because of "
+          "races updating %s/maildirsize", check_path);
+        disable_quota = TRUE;
+        }
 
-      if (mailbox_size < 0) mailbox_size = size;
-      if (mailbox_filecount < 0) mailbox_filecount = filecount;
+      if (maildirsize_fd >= 0)
+        {
+        if (mailbox_size < 0) mailbox_size = size;
+        if (mailbox_filecount < 0) mailbox_filecount = filecount;
+        }
       }
 
     /* No quota enforcement; ensure file does *not* exist; calculate size if
index 7411d9a3e735b807e82ed1079d8704cfe2e1e72e..472b0764dd41c90c750fad3e8e36a9177c0560bd 100644 (file)
@@ -584,7 +584,7 @@ else
       "a later subdirectory modification\n");
     (void)Uunlink(filename);
     (void)close(fd);
-    fd = -1;
+    fd = -2;
     }
   }