]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota-clone: Avoid assert-crash when quota recalculation is triggered.
authorTimo Sirainen <tss@iki.fi>
Thu, 26 Nov 2015 13:42:35 +0000 (15:42 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 26 Nov 2015 13:42:35 +0000 (15:42 +0200)
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.

src/plugins/quota-clone/quota-clone-plugin.c

index 1cc84dd4937305589b738ffdbe2b4d60591898f9..21df35333e30de6e925bb0625b6eed7f0fe72778 100644 (file)
@@ -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)