[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.122,1.123

cras at procontrol.fi cras at procontrol.fi
Sun May 23 19:29:38 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv3997/lib-index

Modified Files:
	mail-index.c 
Log Message:
Don't try to re-map dirty memory mapping.



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- a/mail-index.c	22 May 2004 22:23:29 -0000	1.122
+++ b/mail-index.c	23 May 2004 16:29:35 -0000	1.123
@@ -134,6 +134,8 @@
 	const struct mail_index_header *hdr;
 	unsigned int records_count;
 
+	i_assert(map->buffer == NULL);
+
 	map->mmap_base = index->lock_type != F_WRLCK ?
 		mmap_ro_file(index->fd, &map->mmap_size) :
 		mmap_rw_file(index->fd, &map->mmap_size);
@@ -185,6 +187,8 @@
 	ssize_t ret;
 	size_t pos, records_size;
 
+	i_assert(map->mmap_base == NULL);
+
 	memset(&hdr, 0, sizeof(hdr));
 
 	ret = 1;
@@ -272,6 +276,12 @@
 
 	map = index->map;
 	if (map != NULL && MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
+		if (map->write_to_disk) {
+			/* we have modified this mapping and it's waiting to
+			   be written to disk once we drop exclusive lock.
+			   mapping couldn't have changed, so do nothing. */
+			return 1;
+		}
 		/* FIXME: we need to re-read header */
 	} else if (map != NULL) {
 		/* see if re-mmaping is needed (file has grown) */



More information about the dovecot-cvs mailing list