]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Fixed corruption in some usage patterns.
authorTimo Sirainen <tss@iki.fi>
Wed, 13 May 2015 16:24:55 +0000 (19:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 13 May 2015 16:24:55 +0000 (19:24 +0300)
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.

src/lib-storage/index/mbox/mbox-sync.c

index cf99716f10c1c0e60075952769f0fc24d2f3e978..c9f4883349f74d891ae32506b5c2396b4f7fffc3 100644 (file)
@@ -689,8 +689,10 @@ static int mbox_sync_handle_header(struct mbox_sync_mail_context *mail_ctx)
                }
        } 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;
                }