]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: If mailbox list index refresh fails due to I/O error, don't try to handl...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Dec 2021 02:02:57 +0000 (03:02 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 11 Feb 2022 15:39:38 +0000 (15:39 +0000)
The list index may not have the latest state, so corruption handling could
be breaking it further.

src/lib-storage/list/mailbox-list-index.c

index f00086ea0c0496959d5c6ac86c215c9df360e83b..7a30d51deda253650a3b4e5f35c013278416d7e8 100644 (file)
@@ -559,7 +559,7 @@ int mailbox_list_index_refresh_force(struct mailbox_list *list)
        struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT_REQUIRE(list);
        struct mail_index_view *view;
        int ret;
-       bool refresh;
+       bool refresh, handle_corruption = TRUE;
 
        i_assert(!ilist->syncing);
 
@@ -575,12 +575,18 @@ int mailbox_list_index_refresh_force(struct mailbox_list *list)
            ilist->mailbox_tree == NULL) {
                /* refresh list of mailboxes */
                ret = mailbox_list_index_sync(list, refresh);
+               if (ret < 0) {
+                       /* I/O failure - don't try to handle corruption,
+                          since we don't have the latest state. */
+                       handle_corruption = FALSE;
+               }
        } else {
                ret = mailbox_list_index_parse(list, view, FALSE);
        }
        mail_index_view_close(&view);
 
-       if (mailbox_list_index_handle_corruption(list) < 0) {
+       if (handle_corruption &&
+           mailbox_list_index_handle_corruption(list) < 0) {
                const char *errstr;
                enum mail_error error;