dovecot-2.0: lib-index: More undoing of locking code changes.

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 18 18:14:11 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/0dae63c1af96
changeset: 12300:0dae63c1af96
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 18 16:14:08 2010 +0100
description:
lib-index: More undoing of locking code changes.

diffstat:

 src/lib-index/mail-index-lock.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r 7b47c5a321b9 -r 0dae63c1af96 src/lib-index/mail-index-lock.c
--- a/src/lib-index/mail-index-lock.c	Mon Oct 18 16:07:17 2010 +0100
+++ b/src/lib-index/mail-index-lock.c	Mon Oct 18 16:14:08 2010 +0100
@@ -74,9 +74,15 @@
 		return 1;
 	}
 
-	i_assert(index->file_lock == NULL);
-	ret = mail_index_lock_fd(index, index->filepath, index->fd,
-				 lock_type, timeout_secs, &index->file_lock);
+	if (index->file_lock == NULL) {
+		i_assert(index->lock_type == F_UNLCK);
+		ret = mail_index_lock_fd(index, index->filepath, index->fd,
+					 lock_type, timeout_secs,
+					 &index->file_lock);
+	} else {
+		i_assert(index->lock_type == F_RDLCK && lock_type == F_WRLCK);
+		ret = file_lock_try_update(index->file_lock, lock_type);
+	}
 	if (ret <= 0)
 		return ret;
 


More information about the dovecot-cvs mailing list