[dovecot-cvs] dovecot/src/lib-index mail-index-lock.c,1.25,1.26

cras at dovecot.org cras at dovecot.org
Wed Aug 25 11:06:17 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv14254

Modified Files:
	mail-index-lock.c 
Log Message:
We kept exclusive index lock too long which caused deadlocks.



Index: mail-index-lock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-lock.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mail-index-lock.c	31 Jul 2004 04:14:01 -0000	1.25
+++ mail-index-lock.c	25 Aug 2004 08:06:15 -0000	1.26
@@ -276,16 +276,6 @@
 
 static int mail_index_copy_lock_finish(struct mail_index *index)
 {
-	if (index->shared_lock_count > 0 && !index->fcntl_locks_disable) {
-		/* leave ourself shared locked. */
-		if (file_try_lock(index->fd, F_RDLCK) <= 0) {
-			mail_index_file_set_syscall_error(index,
-							  index->copy_lock_path,
-							  "file_try_lock()");
-			return -1;
-		}
-	}
-
 	if (fsync(index->fd) < 0) {
 		mail_index_file_set_syscall_error(index, index->copy_lock_path,
 						  "fsync()");
@@ -324,6 +314,15 @@
 			(void)close(fd);
 	}
 
+	if (index->shared_lock_count > 0 && !index->fcntl_locks_disable) {
+		/* leave ourself shared locked. */
+		if (file_try_lock(index->fd, F_RDLCK) <= 0) {
+			mail_index_file_set_syscall_error(index,
+							  index->copy_lock_path,
+							  "file_try_lock()");
+		}
+	}
+
 	if (index->copy_lock_path != NULL) {
 		i_assert(index->log_locked);
 



More information about the dovecot-cvs mailing list