]> 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)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 31 Jan 2024 11:45:52 +0000 (13:45 +0200)
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c

index d560465975e89159c1333470373326d9969939a1..8af126de895831c95a7c1a29fe4a1148200c352c 100644 (file)
@@ -950,13 +950,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,
@@ -974,6 +967,13 @@ static int mdbox_storage_rebuild_scan(struct mdbox_storage_rebuild_context *ctx,
        i_warning("mdbox %s: rebuilding indexes: %s",
                  ctx->storage->storage_dir, 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;