From d6b606142e1349f4002a6bd83874399e0edd28bd Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 10 Aug 2016 19:13:09 +0300 Subject: [PATCH] quota: Fixed handling when mail size lookup fails due to mail already being expunged. We don't want to fail it as a quota allocation failure, but just pass through the "mail is expunged" error to the original caller. --- src/plugins/quota/quota.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index cbec924cff..9cac95c898 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -1111,9 +1111,16 @@ int quota_try_alloc(struct quota_transaction_context *ctx, return 1; if (mail_get_physical_size(mail, &size) < 0) { + enum mail_error error; + const char *errstr = mailbox_get_last_error(mail->box, &error); + + if (error == MAIL_ERROR_EXPUNGED) { + /* mail being copied was already expunged. it'll fail, + so just return success for the quota allocated. */ + return 1; + } i_error("quota: Failed to get mail size (box=%s, uid=%u): %s", - mail->box->vname, mail->uid, - mailbox_get_last_error(mail->box, NULL)); + mail->box->vname, mail->uid, errstr); return -1; }