Mercurial > dovecot > core-2.2
changeset 18003:37a3c6c001b7
virtual plugin: Fixed assert-crash when backend mailbox was auto-closed while it had pending expunges.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 25 Oct 2014 02:13:36 +0300 |
parents | 4dc3c0cacd25 |
children | d1aefed4589b |
files | src/plugins/virtual/virtual-storage.c src/plugins/virtual/virtual-sync.c |
diffstat | 2 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-storage.c Sat Oct 25 01:38:43 2014 +0300 +++ b/src/plugins/virtual/virtual-storage.c Sat Oct 25 02:13:36 2014 +0300 @@ -271,6 +271,21 @@ } } +static bool virtual_backend_box_can_close(struct virtual_backend_box *bbox) +{ + if (bbox->box->notify_callback != NULL) { + /* FIXME: IMAP IDLE running - we should support closing this + also if mailbox_list_index=yes */ + return FALSE; + } + if (array_count(&bbox->sync_pending_removes) > 0) { + /* FIXME: we could probably close this by making + syncing support it? */ + return FALSE; + } + return TRUE; +} + static bool virtual_backend_box_close_any_except(struct virtual_mailbox *mbox, struct virtual_backend_box *except_bbox) @@ -285,7 +300,7 @@ if (bbox != except_bbox && bbox->box->transaction_count == 0 && - bbox->box->notify_callback == NULL) { + virtual_backend_box_can_close(bbox)) { i_assert(bbox->sync_mail == NULL); virtual_backend_box_close(mbox, bbox); return TRUE; @@ -298,7 +313,7 @@ if (bbox != except_bbox && bbox->sync_mail != NULL && bbox->box->transaction_count == 1 && - bbox->box->notify_callback == NULL) { + virtual_backend_box_can_close(bbox)) { virtual_backend_box_sync_mail_unset(bbox); i_assert(bbox->box->transaction_count == 0); virtual_backend_box_close(mbox, bbox);
--- a/src/plugins/virtual/virtual-sync.c Sat Oct 25 01:38:43 2014 +0300 +++ b/src/plugins/virtual/virtual-sync.c Sat Oct 25 02:13:36 2014 +0300 @@ -1108,12 +1108,13 @@ MAILBOX_SYNC_FLAG_FAST); if (bbox->search_result == NULL) { - /* first sync in this process. first try to quickly check - if the mailbox has changed. if we can do that check from - mailbox list index, we don't even need to open the - mailbox. */ + /* a) first sync in this process. + b) we had auto-closed this backend mailbox. + + first try to quickly check if the mailbox has changed. + if we can do that check from mailbox list index, we don't + even need to open the mailbox. */ i_assert(array_count(&bbox->sync_pending_removes) == 0); - if (bbox_index_opened || bbox->open_failed) { /* a) index already opened, refresh it b) delayed error handling for mailbox_open()