dovecot-2.2: lib-storage: Fixed \Recent flag race conditions.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 25 17:48:21 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/cd413ab7aeb3
changeset: 15952:cd413ab7aeb3
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 24 15:50:26 2013 +0200
description:
lib-storage: Fixed \Recent flag race conditions.
The \Recent flags should only be set while locked within
mail_index_sync_begin()..commit(). The following view syncing syncs only up
to how far the index was synced, so it won't see any new messages that
haven't yet been assigned a \Recent flag.
diffstat:
src/lib-storage/index/index-status.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (23 lines):
diff -r e33fe1a7bb89 -r cd413ab7aeb3 src/lib-storage/index/index-status.c
--- a/src/lib-storage/index/index-status.c Fri Feb 22 15:49:35 2013 +0200
+++ b/src/lib-storage/index/index-status.c Sun Feb 24 15:50:26 2013 +0200
@@ -48,9 +48,16 @@
hdr = mail_index_get_header(box->view);
status_r->messages = hdr->messages_count;
if ((items & STATUS_RECENT) != 0) {
- /* make sure recent count is set, in case syncing hasn't
- been done yet */
- index_sync_update_recent_count(box);
+ if ((box->flags & MAILBOX_FLAG_DROP_RECENT) != 0) {
+ /* recent flags are set and dropped by the previous
+ sync while index was locked. if we updated the
+ recent flags here we'd have a race condition. */
+ i_assert(box->synced);
+ } else {
+ /* make sure recent count is set, in case we haven't
+ synced yet */
+ index_sync_update_recent_count(box);
+ }
status_r->recent = index_mailbox_get_recent_count(box);
i_assert(status_r->recent <= status_r->messages);
}
More information about the dovecot-cvs
mailing list