dovecot-2.2: LAYOUT=index: Fixed error handling in mailbox creat...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 21 16:12:53 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/4bcca8a822dc
changeset: 19328:4bcca8a822dc
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 21 19:12:45 2015 +0300
description:
LAYOUT=index: Fixed error handling in mailbox creation race condition.
If two processes create the same mailbox, the other one ends up being
deleted on failure. However, if the deletion itself also failed the state
becomes a big ambiguous. We don't want to return MAIL_ERROR_EXISTS in that
case, because the caller may try to open the mailbox with the inconsistent
state and fail. So we'll instead return the original mailbox_delete() error
to the caller.

diffstat:

 src/lib-storage/list/mailbox-list-index-backend.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r a98aaaf55b13 -r 4bcca8a822dc src/lib-storage/list/mailbox-list-index-backend.c
--- a/src/lib-storage/list/mailbox-list-index-backend.c	Wed Oct 21 15:50:31 2015 +0300
+++ b/src/lib-storage/list/mailbox-list-index-backend.c	Wed Oct 21 19:12:45 2015 +0300
@@ -374,7 +374,8 @@
 			if (ret <= 0) {
 				/* failed to add to list. rollback the backend
 				   mailbox creation */
-				(void)mailbox_delete(box);
+				if (mailbox_delete(box) < 0)
+					ret = -1;
 			}
 		}
 		list->create_mailbox_name = old_name;


More information about the dovecot-cvs mailing list