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-Tag: 2.4.0~2464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fe6091de104a9b877736fb070db23e64771bf77;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 1531f6ffe9..a61872c47f 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -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;