Skip to content

Commit

Permalink
lib-index: Make sure error is set on sync & commit failures
Browse files Browse the repository at this point in the history
This avoids "BUG: Unknown internal index error" after view is marked
inconsistent or after index is deleted.
  • Loading branch information
sirainen authored and cmouse committed Jun 26, 2018
1 parent 6bae544 commit 8952ef6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib-index/mail-index-sync.c
Expand Up @@ -850,6 +850,7 @@ int mail_index_sync_commit(struct mail_index_sync_ctx **_ctx)
(ctx->flags & MAIL_INDEX_SYNC_FLAG_TRY_DELETING_INDEX) == 0) {
/* another process just marked the index deleted.
finish the sync, but return error. */
mail_index_set_error_nolog(index, "Index is marked deleted");
ret = -1;
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib-index/mail-index-transaction.c
Expand Up @@ -284,6 +284,7 @@ int mail_index_transaction_commit_full(struct mail_index_transaction **_t,
bool index_undeleted = t->index_undeleted;

if (mail_index_view_is_inconsistent(t->view)) {
mail_index_set_error_nolog(index, "View is inconsistent");
mail_index_transaction_rollback(_t);
return -1;
}
Expand All @@ -292,6 +293,7 @@ int mail_index_transaction_commit_full(struct mail_index_transaction **_t,
(t->view->index->index_delete_requested &&
!t->view->index->syncing)) {
/* no further changes allowed */
mail_index_set_error_nolog(index, "Index is marked deleted");
mail_index_transaction_rollback(_t);
return -1;
}
Expand Down

0 comments on commit 8952ef6

Please sign in to comment.