From: Aki Tuomi Date: Tue, 18 Jul 2017 11:37:53 +0000 (+0300) Subject: lib-index: Mark index deleted if index log file is missing X-Git-Tag: 2.2.32.rc1~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a61bed93bee95a3291f4f4765a36a17d47e76ba;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Mark index deleted if index log file is missing This fixes all kinds of errors caused by mailbox being deleted by another process. --- diff --git a/src/lib-index/mail-index.c b/src/lib-index/mail-index.c index 537a998114..b07a9b927f 100644 --- a/src/lib-index/mail-index.c +++ b/src/lib-index/mail-index.c @@ -931,6 +931,20 @@ void mail_index_file_set_syscall_error(struct mail_index *index, i_assert(filepath != NULL); i_assert(function != NULL); + if (errno == ENOENT) { + struct stat st; + int old_errno = errno; + i_assert(index->log->filepath != NULL); + if (nfs_safe_stat(index->log->filepath, &st) < 0 && + errno == ENOENT) { + /* the index log has gone away */ + index->index_deleted = TRUE; + errno = old_errno; + return; + } + errno = old_errno; + } + if (ENOSPACE(errno)) { index->nodiskspace = TRUE; if ((index->flags & MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) == 0)