From 660242ad27370c2190afb53bc50efa949b06f5f0 Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Mon, 21 Feb 2011 00:38:07 -0500 Subject: [PATCH] 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 1fb19caee..3764a88a1 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 6dbb35262..e5ab65765 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 7411d9a3e..472b0764d 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; } } -- 2.30.2