Skip to content

Commit

Permalink
lib-index: Mark index deleted if index log file is missing
Browse files Browse the repository at this point in the history
This fixes all kinds of errors caused by mailbox being
deleted by another process.
  • Loading branch information
cmouse authored and Timo Sirainen committed Jul 18, 2017
1 parent bb444f7 commit eba2019
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib-index/mail-index.c
Expand Up @@ -946,6 +946,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)
Expand Down

0 comments on commit eba2019

Please sign in to comment.