[dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.16.2.2, 1.16.2.3

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


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

Modified Files:
      Tag: branch_1_0
	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.16.2.2
retrieving revision 1.16.2.3
diff -u -d -r1.16.2.2 -r1.16.2.3
--- mail-index-sync-ext.c	28 May 2006 20:03:07 -0000	1.16.2.2
+++ mail-index-sync-ext.c	17 Jan 2007 14:57:08 -0000	1.16.2.3
@@ -391,6 +391,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