From: Timo Sirainen Date: Thu, 24 Nov 2016 13:14:06 +0000 (+0200) Subject: lib-index: If index open fails with fsck, retry opening once. X-Git-Tag: 2.3.0.rc1~2518 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca2f3260811c4ccd0afb774d7e13a5bd64d0cc34;p=thirdparty%2Fdovecot%2Fcore.git lib-index: If index open fails with fsck, retry opening once. The fsck should have fixed the log offsets and open should work. --- diff --git a/src/lib-index/mail-index-map-read.c b/src/lib-index/mail-index-map-read.c index c21840615e..c9b7f8b31f 100644 --- a/src/lib-index/mail-index-map-read.c +++ b/src/lib-index/mail-index-map-read.c @@ -442,6 +442,14 @@ int mail_index_map(struct mail_index *index, ret = mail_index_sync_map(&index->map, type, TRUE, reason); } + if (ret == 0) { + /* we fsck'd the index. try opening again. */ + ret = mail_index_map_latest_file(index, &reason); + if (ret > 0 && index->indexid != 0) { + ret = mail_index_sync_map(&index->map, + type, TRUE, reason); + } + } } else if (ret == 0 && !index->readonly) { /* make sure we don't try to open the file again */ if (unlink(index->filepath) < 0 && errno != ENOENT)