[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.15.2.12, 1.15.2.13

tss at dovecot.org tss at dovecot.org
Thu Feb 22 13:37:34 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv13056/dbox

Modified Files:
      Tag: branch_1_0
	dbox-storage.c 
Log Message:
When using KEEP_LOCK, the mbox/uidlist file must be locked before index file
is opened. Otherwise we can end up in a deadlock.



Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.15.2.12
retrieving revision 1.15.2.13
diff -u -d -r1.15.2.12 -r1.15.2.13
--- dbox-storage.c	22 Feb 2007 13:08:29 -0000	1.15.2.12
+++ dbox-storage.c	22 Feb 2007 13:37:32 -0000	1.15.2.13
@@ -420,12 +420,7 @@
 	mbox->ibox.storage = istorage;
 	mbox->ibox.mail_vfuncs = &dbox_mail_vfuncs;
 	mbox->ibox.is_recent = dbox_is_recent;
-
-	if (index_storage_mailbox_init(&mbox->ibox, index, name, flags,
-				       FALSE) < 0) {
-		/* the memory was already freed */
-		return NULL;
-	}
+	mbox->ibox.index = index;
 
 	value = getenv("DBOX_ROTATE_SIZE");
 	if (value != NULL)
@@ -453,7 +448,7 @@
 					sizeof(uint64_t), sizeof(uint64_t));
 
 	mbox->uidlist = dbox_uidlist_init(mbox);
-	if (mbox->ibox.keep_locked) {
+	if ((flags & MAILBOX_OPEN_KEEP_LOCKED) != 0) {
 		if (dbox_uidlist_lock(mbox->uidlist) < 0) {
 			struct mailbox *box = &mbox->ibox.box;
 
@@ -464,6 +459,8 @@
 						 dbox_lock_touch_timeout,
 						 mbox);
 	}
+
+	index_storage_mailbox_init(&mbox->ibox, name, flags, FALSE);
 	return &mbox->ibox.box;
 }
 



More information about the dovecot-cvs mailing list