From: Michael M Slusarz Date: Wed, 22 Sep 2021 20:50:50 +0000 (-0600) Subject: fts: Don't overwrite INUSE error if indexing times out X-Git-Tag: 2.3.18~92 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2beae65898431d9fb88e210c6d3a22fec6e35222;p=thirdparty%2Fdovecot%2Fcore.git fts: Don't overwrite INUSE error if indexing times out --- diff --git a/src/plugins/fts/fts-indexer.c b/src/plugins/fts/fts-indexer.c index 769ef7abab..aca23c9c20 100644 --- a/src/plugins/fts/fts-indexer.c +++ b/src/plugins/fts/fts-indexer.c @@ -94,7 +94,10 @@ int fts_indexer_more(struct fts_indexer_context *ctx) int ret; if ((ret = fts_indexer_more_int(ctx)) < 0) { - mail_storage_set_internal_error(ctx->box->storage); + /* If failed is already set, the code has had a chance to + * set an internal error already, i.e. MAIL_ERROR_INUSE. */ + if (!ctx->failed) + mail_storage_set_internal_error(ctx->box->storage); ctx->failed = TRUE; return -1; } diff --git a/src/plugins/fts/fts-storage.c b/src/plugins/fts/fts-storage.c index 5ecbae5869..04f2aec738 100644 --- a/src/plugins/fts/fts-storage.c +++ b/src/plugins/fts/fts-storage.c @@ -391,8 +391,8 @@ static int fts_mailbox_search_deinit(struct mail_search_context *ctx) } if (fctx->indexing_timed_out) ret = -1; - if (!fctx->fts_lookup_success && - fctx->enforced != FTS_ENFORCED_NO) { + else if (!fctx->fts_lookup_success && + fctx->enforced != FTS_ENFORCED_NO) { /* FTS lookup failed and we didn't want to fallback to opening all the mails and searching manually */ mail_storage_set_internal_error(ctx->transaction->box->storage);