From: Timo Sirainen Date: Fri, 10 Apr 2009 22:27:02 +0000 (-0400) Subject: dbox: Fix to auto-purging. X-Git-Tag: 2.0.alpha1~984 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb8b2e66dc8506a00efabfb4b7b4be50a886b132;p=thirdparty%2Fdovecot%2Fcore.git dbox: Fix to auto-purging. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox/dbox-save.c b/src/lib-storage/index/dbox/dbox-save.c index 724daa6e2b..49ecafd5b9 100644 --- a/src/lib-storage/index/dbox/dbox-save.c +++ b/src/lib-storage/index/dbox/dbox-save.c @@ -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; diff --git a/src/lib-storage/index/dbox/dbox-sync.c b/src/lib-storage/index/dbox/dbox-sync.c index 708c93024c..3b09f6bbe3 100644 --- a/src/lib-storage/index/dbox/dbox-sync.c +++ b/src/lib-storage/index/dbox/dbox-sync.c @@ -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; diff --git a/src/lib-storage/index/dbox/dbox-sync.h b/src/lib-storage/index/dbox/dbox-sync.h index 297e8f30a2..86ca29ccfb 100644 --- a/src/lib-storage/index/dbox/dbox-sync.h +++ b/src/lib-storage/index/dbox/dbox-sync.h @@ -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;