changeset 16542:04c7cf45a597

mbox: Avoid assert-crashing by too optimistically upgrading a lock to write-lock.
author Timo Sirainen <tss@iki.fi>
date Mon, 24 Jun 2013 23:10:20 +0300
parents 07e314199f56
children 082fe68e38c9
files src/lib-storage/index/mbox/mbox-lock.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-lock.c	Mon Jun 24 23:06:45 2013 +0300
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Mon Jun 24 23:10:20 2013 +0300
@@ -784,7 +784,8 @@
 	bool fcntl_locked;
 	int ret;
 
-	if (lock_type == F_RDLCK && mbox->external_transactions > 0) {
+	if (lock_type == F_RDLCK && mbox->external_transactions > 0 &&
+	    mbox->mbox_lock_type != F_RDLCK) {
 		/* we have a transaction open that is going to save mails
 		   and apparently also wants to read from the same mailbox
 		   (copy, move, catenate). we need to write lock the mailbox,