From: Timo Sirainen Date: Mon, 3 Jul 2023 20:37:20 +0000 (+0300) Subject: mdbox: fsck map index only after logging "rebuilding indexes" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b148ff33b94e9b3dc578755641d123e5f77e2286;p=thirdparty%2Fdovecot%2Fcore.git mdbox: fsck map index only after logging "rebuilding indexes" --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index d560465975..8af126de89 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -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;