From: Timo Sirainen Date: Thu, 26 Nov 2015 13:42:35 +0000 (+0200) Subject: quota-clone: Avoid assert-crash when quota recalculation is triggered. X-Git-Tag: 2.2.20.rc1~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8705e45564a2e87d32bd825e0e997a8177846f77;p=thirdparty%2Fdovecot%2Fcore.git quota-clone: Avoid assert-crash when quota recalculation is triggered. Quota recalculation opened all mailboxes and got us back to quota_clone_flush(), which caused another dict transaction to be opened, which caused a crash with some dict backends. --- diff --git a/src/plugins/quota-clone/quota-clone-plugin.c b/src/plugins/quota-clone/quota-clone-plugin.c index 1cc84dd493..21df35333e 100644 --- a/src/plugins/quota-clone/quota-clone-plugin.c +++ b/src/plugins/quota-clone/quota-clone-plugin.c @@ -29,6 +29,7 @@ struct quota_clone_user { struct quota_clone_mailbox { union mailbox_module_context module_ctx; bool quota_changed; + bool quota_flushing; }; static void quota_clone_flush(struct mailbox *box) @@ -114,8 +115,14 @@ static void quota_clone_mailbox_close(struct mailbox *box) struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); qbox->module_ctx.super.close(box); - if (qbox->quota_changed) + + if (qbox->quota_flushing) { + /* recursing back from quota recalculation */ + } else if (qbox->quota_changed) { + qbox->quota_flushing = TRUE; quota_clone_flush(box); + qbox->quota_flushing = FALSE; + } } static void quota_clone_mailbox_allocated(struct mailbox *box)