[dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.22, 1.23

tss at dovecot.org tss at dovecot.org
Wed Jan 17 14:57:13 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv27001

Modified Files:
	mail-index-sync-ext.c 
Log Message:
A new "extension introduction" in transaction log could have left some
existing views to contain an invalid mapping where it contained the new
extension, but with a wrong record_size.



Index: mail-index-sync-ext.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-ext.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mail-index-sync-ext.c	10 Sep 2006 12:48:18 -0000	1.22
+++ mail-index-sync-ext.c	17 Jan 2007 14:57:11 -0000	1.23
@@ -381,6 +381,18 @@
 		return 1;
 	}
 
+	if (map->refcount != 1) {
+		/* below we'll first add the extension to the mapping, and then
+		   call sync_ext_reorder() which clones the map. that however
+		   leaves this mapping with the new extension, but without
+		   a resized record_size. if the mapping is still used
+		   elsewhere, it will create problems. so here we'll just make
+		   sure that the partially updated mapping will get destroyed
+		   once the resize is complete. */
+		map = mail_index_map_clone(map, map->hdr.record_size);
+		mail_index_sync_replace_map(ctx, map);
+	}
+
 	hdr_buf = map->hdr_copy_buf;
 	if (MAIL_INDEX_HEADER_SIZE_ALIGN(hdr_buf->used) != hdr_buf->used) {
 		/* we need to add padding between base header and extensions */



More information about the dovecot-cvs mailing list