]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Fix to auto-purging.
authorTimo Sirainen <tss@iki.fi>
Fri, 10 Apr 2009 22:27:02 +0000 (18:27 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 10 Apr 2009 22:27:02 +0000 (18:27 -0400)
--HG--
branch : HEAD

src/lib-storage/index/dbox/dbox-save.c
src/lib-storage/index/dbox/dbox-sync.c
src/lib-storage/index/dbox/dbox-sync.h

index 724daa6e2be649da94d877671de9b45754de733b..49ecafd5b9fe27e3bea029e25893022aa6549d2c 100644 (file)
@@ -353,7 +353,8 @@ int dbox_transaction_save_commit_pre(struct dbox_save_context *ctx)
        i_assert(ctx->finished);
 
        /* lock the mailbox before map to avoid deadlocks */
-       if (dbox_sync_begin(ctx->mbox, DBOX_SYNC_FLAG_FORCE |
+       if (dbox_sync_begin(ctx->mbox, DBOX_SYNC_FLAG_NO_PURGE |
+                           DBOX_SYNC_FLAG_FORCE |
                            DBOX_SYNC_FLAG_FSYNC, &ctx->sync_ctx) < 0) {
                dbox_transaction_save_rollback(ctx);
                return -1;
index 708c93024c8849a9fe41a31a66910f681d88b493..3b09f6bbe3b2af636098f85b19eb9181bb7bc414 100644 (file)
@@ -169,7 +169,8 @@ static int dbox_sync_index(struct dbox_sync_context *ctx)
                           that's why we do this calculation before current
                           sync: the purging is triggered only after the
                           second expunge. */
-                       if (dbox_map_want_purge(ctx->mbox->storage->map))
+                       if ((ctx->flags & DBOX_SYNC_FLAG_NO_PURGE) == 0 &&
+                           dbox_map_want_purge(ctx->mbox->storage->map))
                                ctx->purge = TRUE;
                }
 
@@ -243,6 +244,7 @@ int dbox_sync_begin(struct dbox_mailbox *mbox, enum dbox_sync_flags flags,
 
        ctx = i_new(struct dbox_sync_context, 1);
        ctx->mbox = mbox;
+       ctx->flags = flags;
 
        if (!mbox->ibox.keep_recent)
                sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
index 297e8f30a2d36b3d2d0205a0bfebba1e790cd1d6..86ca29ccfbf93528baf50ffcec958b130bc59d63 100644 (file)
@@ -7,7 +7,8 @@ struct dbox_mailbox;
 enum dbox_sync_flags {
        DBOX_SYNC_FLAG_FORCE            = 0x01,
        DBOX_SYNC_FLAG_FSYNC            = 0x02,
-       DBOX_SYNC_FLAG_FORCE_REBUILD    = 0x04
+       DBOX_SYNC_FLAG_FORCE_REBUILD    = 0x04,
+       DBOX_SYNC_FLAG_NO_PURGE         = 0x08
 };
 
 struct dbox_sync_file_entry {
@@ -25,6 +26,7 @@ struct dbox_sync_context {
        struct mail_index_view *sync_view;
        struct mail_index_transaction *trans;
        struct dbox_map_transaction_context *map_trans;
+       enum dbox_sync_flags flags;
 
        string_t *path;
        unsigned int path_dir_prefix_len;