dovecot: Copies were tracked using the source transaction instea...

dovecot at dovecot.org dovecot at dovecot.org
Sun Mar 2 06:24:09 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/bb78360d7aa4
changeset: 7310:bb78360d7aa4
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Mar 02 06:24:05 2008 +0200
description:
Copies were tracked using the source transaction instead of destination
transaction, so rollbacking source transaction logged bogus "transaction
rolled back" messages.

diffstat:

1 file changed, 9 insertions(+), 8 deletions(-)
src/plugins/mail-log/mail-log-plugin.c |   17 +++++++++--------

diffs (57 lines):

diff -r f8d49fe38db5 -r bb78360d7aa4 src/plugins/mail-log/mail-log-plugin.c
--- a/src/plugins/mail-log/mail-log-plugin.c	Sun Mar 02 06:09:44 2008 +0200
+++ b/src/plugins/mail-log/mail-log-plugin.c	Sun Mar 02 06:24:05 2008 +0200
@@ -255,11 +255,11 @@ mail_log_group_changes(struct mailbox *b
 	}
 }
 
-static void mail_log_action(struct mail *mail, enum mail_log_event event,
+static void mail_log_action(struct mailbox_transaction_context *dest_trans,
+			    struct mail *mail, enum mail_log_event event,
 			    const char *data)
 {
-	struct mail_log_transaction_context *lt =
-		MAIL_LOG_CONTEXT(mail->transaction);
+	struct mail_log_transaction_context *lt = MAIL_LOG_CONTEXT(dest_trans);
 	const char *msgid;
 	uoff_t size;
 	string_t *str;
@@ -272,8 +272,7 @@ static void mail_log_action(struct mail 
 		pool = pool_alloconly_create("mail log transaction", 1024);
 		lt = p_new(pool, struct mail_log_transaction_context, 1);
 		lt->pool = pool;
-		MODULE_CONTEXT_SET(mail->transaction,
-				   mail_log_storage_module, lt);
+		MODULE_CONTEXT_SET(dest_trans, mail_log_storage_module, lt);
 	}
 	lt->changes++;
 
@@ -322,7 +321,8 @@ static void mail_log_mail_expunge(struct
 	union mail_module_context *lmail = MAIL_LOG_MAIL_CONTEXT(mail);
 
 	T_BEGIN {
-		mail_log_action(_mail, MAIL_LOG_EVENT_EXPUNGE, NULL);
+		mail_log_action(_mail->transaction, _mail,
+				MAIL_LOG_EVENT_EXPUNGE, NULL);
 	} T_END;
 	lmail->super.expunge(_mail);
 }
@@ -354,7 +354,8 @@ mail_log_mail_update_flags(struct mail *
 		return;
 
 	T_BEGIN {
-		mail_log_action(_mail, (new_flags & MAIL_DELETED) != 0 ?
+		mail_log_action(_mail->transaction, _mail,
+				(new_flags & MAIL_DELETED) != 0 ?
 				MAIL_LOG_EVENT_DELETE :
 				MAIL_LOG_EVENT_UNDELETE, NULL);
 	} T_END;
@@ -396,7 +397,7 @@ mail_log_copy(struct mailbox_transaction
 	T_BEGIN {
 		name = str_sanitize(mailbox_get_name(t->box),
 				    MAILBOX_NAME_LOG_LEN);
-		mail_log_action(mail, MAIL_LOG_EVENT_COPY, name);
+		mail_log_action(t, mail, MAIL_LOG_EVENT_COPY, name);
 	} T_END;
 	return 0;
 }


More information about the dovecot-cvs mailing list