[exim-cvs] Deal with maildir quota file races.

Top Pagina
Delete this message
Reply to this message
Auteur: Exim Git Commits Mailing List
Datum:  
Aan: exim-cvs
Onderwerp: [exim-cvs] Deal with maildir quota file races.
Gitweb: http://git.exim.org/exim.git/commitdiff/660242ad27370c2190afb53bc50efa949b06f5f0
Commit:     660242ad27370c2190afb53bc50efa949b06f5f0
Parent:     29cfeb94e35eb8fe2b6f02fe9c9444edb251fd71
Author:     Phil Pennock <pdp@???>
AuthorDate: Mon Feb 21 00:38:07 2011 -0500
Committer:  Phil Pennock <pdp@???>
CommitDate: Mon Feb 21 00:39:09 2011 -0500


    Deal with maildir quota file races.


    Based on patch from Heiko Schlittermann.
    Fixes bug 1086.
---
 doc/doc-txt/ChangeLog           |    3 +++
 src/src/transports/appendfile.c |   13 +++++++++++--
 src/src/transports/tf_maildir.c |    2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 1fb19ca..3764a88 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -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
 -----------------
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c
index 6dbb352..e5ab657 100644
--- a/src/src/transports/appendfile.c
+++ b/src/src/transports/appendfile.c
@@ -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
diff --git a/src/src/transports/tf_maildir.c b/src/src/transports/tf_maildir.c
index 7411d9a..472b076 100644
--- a/src/src/transports/tf_maildir.c
+++ b/src/src/transports/tf_maildir.c
@@ -584,7 +584,7 @@ else
       "a later subdirectory modification\n");
     (void)Uunlink(filename);
     (void)close(fd);
-    fd = -1;
+    fd = -2;
     }
   }