]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: dbox - Use mailbox_list_index_rebuild
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 9 Aug 2021 11:23:13 +0000 (14:23 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 7 Sep 2021 08:38:03 +0000 (08:38 +0000)
src/lib-storage/index/dbox-multi/mdbox-storage.c
src/lib-storage/index/dbox-multi/mdbox-sync.c
src/lib-storage/index/dbox-single/sdbox-storage.c
src/lib-storage/index/dbox-single/sdbox-sync.c
src/lib-storage/index/index-storage.c

index df2bce551d933405d1c6771156e5f193c31570ea..eff2a27cc4794b21a59732a0e09346d69e48b74e 100644 (file)
@@ -465,7 +465,7 @@ struct mail_storage mdbox_storage = {
                mdbox_storage_autodetect,
                mdbox_mailbox_alloc,
                mdbox_purge,
-               NULL,
+               mail_storage_list_index_rebuild,
        }
 };
 
index 595c4d8db70b3a720ac5a21161ed5daf958b45c1..0c2d2d4ce504c4018c23098015501ca83c1ca93c 100644 (file)
@@ -319,6 +319,7 @@ int mdbox_sync_begin(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags,
 int mdbox_sync_finish(struct mdbox_sync_context **_ctx, bool success)
 {
        struct mdbox_sync_context *ctx = *_ctx;
+       struct mail_storage *storage = &ctx->mbox->storage->storage.storage;
        int ret = success ? 0 : -1;
 
        *_ctx = NULL;
@@ -332,6 +333,9 @@ int mdbox_sync_finish(struct mdbox_sync_context **_ctx, bool success)
                mail_index_sync_rollback(&ctx->index_sync_ctx);
        }
 
+       if (storage->rebuild_list_index)
+               ret = mail_storage_list_index_rebuild_and_set_uncorrupted(storage);
+
        i_free(ctx);
        return ret;
 }
index 4d3fb4a0d9aed909e9a98a22ae33d18d193d55d5..e43421cb59ed0826aa3e49f232954f4ebb28342e 100644 (file)
@@ -450,7 +450,7 @@ struct mail_storage sdbox_storage = {
                sdbox_storage_autodetect,
                sdbox_mailbox_alloc,
                NULL,
-               NULL,
+               mail_storage_list_index_rebuild,
        }
 };
 
@@ -469,7 +469,7 @@ struct mail_storage dbox_storage = {
                sdbox_storage_autodetect,
                sdbox_mailbox_alloc,
                NULL,
-               NULL,
+               mail_storage_list_index_rebuild,
        }
 };
 
index d7c5b7da16e0ac67cd2fbafa7b29bd44931c7e66..670b768dec525ad31b208a38212665663523f561 100644 (file)
@@ -266,6 +266,7 @@ int sdbox_sync_begin(struct sdbox_mailbox *mbox, enum sdbox_sync_flags flags,
 int sdbox_sync_finish(struct sdbox_sync_context **_ctx, bool success)
 {
        struct sdbox_sync_context *ctx = *_ctx;
+       struct mail_storage *storage = &ctx->mbox->storage->storage.storage;
        int ret = success ? 0 : -1;
 
        *_ctx = NULL;
@@ -284,6 +285,9 @@ int sdbox_sync_finish(struct sdbox_sync_context **_ctx, bool success)
                mail_index_sync_rollback(&ctx->index_sync_ctx);
        }
 
+        if (storage->rebuild_list_index)
+               ret = mail_storage_list_index_rebuild_and_set_uncorrupted(storage);
+
        index_storage_expunging_deinit(&ctx->mbox->box);
        array_free(&ctx->expunged_uids);
        i_free(ctx);
index caf34401f8a79975ba4064b2cf041a79de3ea752..543620594f271de6c7ef91e9b1ca7c3e766938f7 100644 (file)
@@ -9,6 +9,7 @@
 #include "str-sanitize.h"
 #include "mkdir-parents.h"
 #include "dict.h"
+#include "fs-api.h"
 #include "message-header-parser.h"
 #include "mail-index-alloc-cache.h"
 #include "mail-index-private.h"
@@ -1127,6 +1128,7 @@ void index_storage_destroy(struct mail_storage *storage)
                dict_wait(storage->_shared_attr_dict);
                dict_deinit(&storage->_shared_attr_dict);
        }
+       fs_unref(&storage->mailboxes_fs);
 }
 
 static void index_storage_expunging_init(struct mailbox *box)