dovecot-2.2: mailbox_list_index: Assert-crashfix when seeing a n...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 4 15:03:28 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/1d2122f10411
changeset: 15017:1d2122f10411
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 04 15:03:17 2012 +0300
description:
mailbox_list_index: Assert-crashfix when seeing a new mailbox with children.

diffstat:

 src/lib-storage/list/mailbox-list-index-sync.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (59 lines):

diff -r cf6f14ec3937 -r 1d2122f10411 src/lib-storage/list/mailbox-list-index-sync.c
--- a/src/lib-storage/list/mailbox-list-index-sync.c	Tue Sep 04 14:56:13 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-index-sync.c	Tue Sep 04 15:03:17 2012 +0300
@@ -256,6 +256,7 @@
 	struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list);
 	struct mailbox_list_index_sync_context sync_ctx;
 	struct mailbox_list_iterate_context *iter;
+	struct mail_index_view *view;
 	const struct mail_index_header *hdr;
 	const struct mailbox_info *info;
 	const char *patterns[2];
@@ -269,19 +270,20 @@
 	sync_ctx.ilist = ilist;
 	sync_ctx.sep[0] = mailbox_list_get_hierarchy_sep(list);
 	if (mail_index_sync_begin(ilist->index, &sync_ctx.sync_ctx,
-				  &sync_ctx.view, &sync_ctx.trans,
+				  &view, &sync_ctx.trans,
 				  MAIL_INDEX_SYNC_FLAG_AVOID_FLAG_UPDATES) < 0) {
 		mailbox_list_index_set_index_error(list);
 		return -1;
 	}
+
 	/* re-parse mailbox list now that it's refreshed and locked */
-	if (mailbox_list_index_parse(ilist, sync_ctx.view, TRUE) < 0) {
+	if (mailbox_list_index_parse(ilist, view, TRUE) < 0) {
 		mail_index_sync_rollback(&sync_ctx.sync_ctx);
 		return -1;
 	}
 	orig_highest_name_id = ilist->highest_name_id;
 
-	hdr = mail_index_get_header(sync_ctx.view);
+	hdr = mail_index_get_header(view);
 	sync_ctx.next_uid = hdr->next_uid;
 
 	if (hdr->uid_validity == 0) {
@@ -292,6 +294,7 @@
 			offsetof(struct mail_index_header, uid_validity),
 			&uid_validity, sizeof(uid_validity), TRUE);
 	}
+	sync_ctx.view = mail_index_transaction_open_updated_view(sync_ctx.trans);
 
 	/* clear EXISTS-flags, so after sync we know what can be expunged */
 	mailbox_list_index_node_clear_exists(ilist->mailbox_tree);
@@ -324,6 +327,7 @@
 	}
 	if (ilist->module_ctx.super.iter_deinit(iter) < 0) {
 		mail_index_sync_rollback(&sync_ctx.sync_ctx);
+		mail_index_view_close(&sync_ctx.view);
 		ilist->syncing = FALSE;
 		return -1;
 	}
@@ -345,6 +349,7 @@
 			&new_hdr.refresh_flag, sizeof(new_hdr.refresh_flag));
 	}
 	ilist->syncing = FALSE;
+	mail_index_view_close(&sync_ctx.view);
 
 	if (mail_index_sync_commit(&sync_ctx.sync_ctx) < 0) {
 		mailbox_list_index_set_index_error(list);


More information about the dovecot-cvs mailing list