diff src/lib-storage/index/maildir/maildir-sync.c @ 2393:d598c82a3c22 HEAD

Renamed mail_index_sync_end() to _commit() and added _rollback(). Fixed mbox deadlocking issue.
author Timo Sirainen <tss@iki.fi>
date Fri, 30 Jul 2004 08:08:35 +0300
parents 9c830d1a4ebf
children 89911d2a9126
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync.c	Fri Jul 30 08:07:50 2004 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Fri Jul 30 08:08:35 2004 +0300
@@ -350,7 +350,7 @@
 		}
 		if (mail_index_transaction_commit(ctx.trans, &seq, &offset) < 0)
 			ret = -1;
-		if (mail_index_sync_end(ctx.sync_ctx) < 0)
+		if (mail_index_sync_commit(ctx.sync_ctx) < 0)
 			ret = -1;
 	}
         ibox->syncing_commit = FALSE;
@@ -612,7 +612,7 @@
 			"Maildir %s sync: UIDVALIDITY changed (%u -> %u)",
 			ibox->path, hdr->uid_validity, uid_validity);
 		mail_index_mark_corrupted(ibox->index);
-		(void)mail_index_sync_end(sync_ctx.sync_ctx);
+		(void)mail_index_sync_rollback(sync_ctx.sync_ctx);
 		return -1;
 	}
 
@@ -815,9 +815,10 @@
 			&next_uid, sizeof(next_uid));
 	}
 
-	if (ret < 0)
+	if (ret < 0) {
 		mail_index_transaction_rollback(trans);
-	else {
+		mail_index_sync_rollback(sync_ctx.sync_ctx);
+	} else {
 		uint32_t seq;
 		uoff_t offset;
 
@@ -827,11 +828,10 @@
 			ibox->commit_log_file_seq = seq;
 			ibox->commit_log_file_offset = offset;
 		}
+		if (mail_index_sync_commit(sync_ctx.sync_ctx) < 0)
+			ret = -1;
 	}
 
-	if (mail_index_sync_end(sync_ctx.sync_ctx) < 0)
-		ret = -1;
-
 	if (ret == 0) {
 		ibox->commit_log_file_seq = 0;
 		ibox->commit_log_file_offset = 0;