dovecot-2.0: mdbox: Make sure map transaction won't succeed afte...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 4 14:13:16 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.0/rev/de5b3386a88a
changeset: 13096:de5b3386a88a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 04 13:59:40 2012 +0300
description:
mdbox: Make sure map transaction won't succeed after mdbox_map_atomic_set_failed()

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-map-private.h |  1 +
 src/lib-storage/index/dbox-multi/mdbox-map.c         |  8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 555e4b002a7f -r de5b3386a88a src/lib-storage/index/dbox-multi/mdbox-map-private.h
--- a/src/lib-storage/index/dbox-multi/mdbox-map-private.h	Sat May 19 22:25:27 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-map-private.h	Mon Jun 04 13:59:40 2012 +0300
@@ -55,6 +55,7 @@
 	unsigned int map_refreshed:1;
 	unsigned int locked:1;
 	unsigned int success:1;
+	unsigned int failed:1;
 };
 
 int mdbox_map_view_lookup_rec(struct mdbox_map *map,
diff -r 555e4b002a7f -r de5b3386a88a src/lib-storage/index/dbox-multi/mdbox-map.c
--- a/src/lib-storage/index/dbox-multi/mdbox-map.c	Sat May 19 22:25:27 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-map.c	Mon Jun 04 13:59:40 2012 +0300
@@ -493,11 +493,13 @@
 void mdbox_map_atomic_set_failed(struct mdbox_map_atomic_context *atomic)
 {
 	atomic->success = FALSE;
+	atomic->failed = TRUE;
 }
 
 void mdbox_map_atomic_set_success(struct mdbox_map_atomic_context *atomic)
 {
-	atomic->success = TRUE;
+	if (!atomic->failed)
+		atomic->success = TRUE;
 }
 
 int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **_atomic)
@@ -569,7 +571,7 @@
 		mail_index_reset_error(ctx->atomic->map->index);
 		return -1;
 	}
-	ctx->atomic->success = TRUE;
+	mdbox_map_atomic_set_success(ctx->atomic);
 	return 0;
 }
 
@@ -1294,7 +1296,7 @@
 		if (dbox_file_append_commit(&file_appends[i]) < 0)
 			return -1;
 	}
-	ctx->atomic->success = TRUE;
+	mdbox_map_atomic_set_success(ctx->atomic);
 	return 0;
 }
 


More information about the dovecot-cvs mailing list