changeset 18679:b6ea460e7cc4

mbox: Fixed corruption in some usage patterns. Something like: - first mail is being expunged - other mails are being rewritten and they get their space from the expunged mail - there's not enough space for the last mail to get space - we add more space - we'll now need to use up the space. We can't just decide to mark the mails dirty.
author Timo Sirainen <tss@iki.fi>
date Wed, 13 May 2015 19:24:55 +0300
parents 8973648dd361
children 1171265c3834
files src/lib-storage/index/mbox/mbox-sync.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c	Wed May 13 17:16:21 2015 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Wed May 13 19:24:55 2015 +0300
@@ -689,8 +689,10 @@
 		}
 	} else if (mail_ctx->need_rewrite) {
 		mbox_sync_update_header(mail_ctx);
-		if (sync_ctx->delay_writes) {
-			/* mark it dirty and do it later */
+		if (sync_ctx->delay_writes && sync_ctx->need_space_seq == 0) {
+			/* mark it dirty and do it later. we can't do this
+			   if we're in the middle of rewriting acquiring more
+			   space. */
 			mail_ctx->dirty = TRUE;
 			return 0;
 		}