]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: If index open fails with fsck, retry opening once.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 24 Nov 2016 13:14:06 +0000 (15:14 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 25 Nov 2016 13:29:56 +0000 (15:29 +0200)
The fsck should have fixed the log offsets and open should work.

src/lib-index/mail-index-map-read.c

index b17a74043373b70bf66dec6a4a5a3f52a6717a36..95ff4f3aa22e5443673f342c0565432ec4df4c27 100644 (file)
@@ -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)