From: Timo Sirainen Date: Thu, 2 Apr 2020 21:07:23 +0000 (+0300) Subject: lib-index: mail_cache_set_seq_corrupted_reason() - Don't delete entire cache if trans... X-Git-Tag: 2.3.11.2~362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdbd12509d9808cf1a5006433420ec0bb4969c2a;p=thirdparty%2Fdovecot%2Fcore.git lib-index: mail_cache_set_seq_corrupted_reason() - Don't delete entire cache if transaction commit fails It can only happen on I/O errors, which most likely means that there's no disk space to write to transaction log. There's no reason to delete the entire cache, since it might be expensive to recreate. --- diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 8afb3e9616..77f581aaee 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -73,10 +73,12 @@ void mail_cache_set_seq_corrupted_reason(struct mail_cache_view *cache_view, mail_index_transaction_begin(view, MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL); mail_index_update_ext(t, seq, cache->ext_id, &empty, NULL); - if (mail_index_transaction_commit(&t) < 0) - mail_cache_reset(cache); - else - mail_cache_expunge_count(cache, 1); + if (mail_index_transaction_commit(&t) < 0) { + /* I/O error (e.g. out of disk space). Ignore this for now, + maybe it works again later. */ + return; + } + mail_cache_expunge_count(cache, 1); } void mail_cache_file_close(struct mail_cache *cache)