dovecot-2.2: virtual plugin: Fixed assert-crash when backend mai...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 24 23:14:30 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/37a3c6c001b7
changeset: 18003:37a3c6c001b7
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 25 02:13:36 2014 +0300
description:
virtual plugin: Fixed assert-crash when backend mailbox was auto-closed while it had pending expunges.

diffstat:

 src/plugins/virtual/virtual-storage.c |  19 +++++++++++++++++--
 src/plugins/virtual/virtual-sync.c    |  11 ++++++-----
 2 files changed, 23 insertions(+), 7 deletions(-)

diffs (65 lines):

diff -r 4dc3c0cacd25 -r 37a3c6c001b7 src/plugins/virtual/virtual-storage.c
--- 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);
diff -r 4dc3c0cacd25 -r 37a3c6c001b7 src/plugins/virtual/virtual-sync.c
--- 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()


More information about the dovecot-cvs mailing list