[dovecot-cvs] dovecot/src/lib-index mail-index-fsck.c, 1.25, 1.26 mail-index-private.h, 1.41, 1.42 mail-index-sync-update.c, 1.70, 1.71 mail-index.c, 1.176, 1.177

cras at dovecot.org cras at dovecot.org
Sun Dec 5 03:41:48 EET 2004


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

Modified Files:
	mail-index-fsck.c mail-index-private.h 
	mail-index-sync-update.c mail-index.c 
Log Message:
Don't try to fsck when we're modifying index. It could have happened with
corrupted transaction logs.



Index: mail-index-fsck.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-fsck.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mail-index-fsck.c	4 Dec 2004 21:56:19 -0000	1.25
+++ mail-index-fsck.c	5 Dec 2004 01:41:45 -0000	1.26
@@ -114,6 +114,11 @@
 	uoff_t file_offset;
 	int ret, lock_log;
 
+	if (index->sync_update) {
+		/* we're modifying index, don't do anything */
+		return 1;
+	}
+
         lock_log = !index->log_locked;
 	if (lock_log) {
 		if (mail_transaction_log_sync_lock(index->log, &file_seq,

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- mail-index-private.h	5 Dec 2004 01:38:17 -0000	1.41
+++ mail-index-private.h	5 Dec 2004 01:41:45 -0000	1.42
@@ -127,6 +127,7 @@
 	unsigned int mmap_no_write:1;
 	unsigned int readonly:1;
 	unsigned int fsck:1;
+	unsigned int sync_update:1;
 };
 
 enum mail_index_sync_handler_type {

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- mail-index-sync-update.c	4 Dec 2004 22:04:45 -0000	1.70
+++ mail-index-sync-update.c	5 Dec 2004 01:41:45 -0000	1.71
@@ -1108,6 +1108,9 @@
 	if (had_dirty)
 		map->hdr.flags &= ~MAIL_INDEX_HDR_FLAG_HAVE_DIRTY;
 
+	/* make sure we don't go doing fsck while modifying the index */
+	index->sync_update = TRUE;
+
 	first_append_uid = 0;
 	check_ext_offsets = TRUE;
 	while ((ret = mail_transaction_log_view_next(view->log_view, &thdr,
@@ -1163,6 +1166,8 @@
 	map = view->map;
         mail_index_sync_map_deinit(&sync_map_ctx);
 
+	index->sync_update = FALSE;
+
 	if (ret < 0) {
 		mail_index_view_unlock(view);
 		return -1;

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- mail-index.c	5 Dec 2004 01:38:17 -0000	1.176
+++ mail-index.c	5 Dec 2004 01:41:45 -0000	1.177
@@ -657,8 +657,10 @@
 
 	if ((*map)->hdr.indexid != 0) {
 		/* sync this as a view from transaction log. */
+		index->sync_update = TRUE;
 		ret = mail_index_sync_from_transactions(index, map,
 							sync_to_index);
+		index->sync_update = FALSE;
 		if (ret != 0)
 			return ret;
 



More information about the dovecot-cvs mailing list