]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: fsck map index only after logging "rebuilding indexes"
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 3 Jul 2023 20:37:20 +0000 (23:37 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Oct 2023 08:40:13 +0000 (08:40 +0000)
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c

index 1531f6ffe97fe37edc2e9d1bc9aabc38b584fa97..a61872c47f3cf86b5694169766f69175bfca987e 100644 (file)
@@ -954,13 +954,6 @@ mdbox_storage_rebuild_scan_prepare(struct mdbox_storage_rebuild_context *ctx,
                return 0;
        }
 
-       /* fsck the map just in case its UIDs are broken */
-       if (mail_index_fsck(ctx->storage->map->index) < 0) {
-               mail_storage_set_index_error(&ctx->storage->storage.storage,
-                                            ctx->storage->map->index);
-               return -1;
-       }
-
        /* get old map header */
        mail_index_get_header_ext(ctx->atomic->sync_view,
                                  ctx->storage->map->map_ext_id,
@@ -980,6 +973,13 @@ static int mdbox_storage_rebuild_scan(struct mdbox_storage_rebuild_context *ctx,
        struct event *event = ctx->storage->storage.storage.event;
        e_warning(event, "rebuilding indexes: %s", reason);
 
+       /* fsck the map just in case its UIDs are broken */
+       if (mail_index_fsck(ctx->storage->map->index) < 0) {
+               mail_storage_set_index_error(&ctx->storage->storage.storage,
+                                            ctx->storage->map->index);
+               return -1;
+       }
+
        if (mdbox_storage_rebuild_scan_dir(ctx, ctx->storage->storage_dir,
                                           FALSE) < 0)
                return -1;