dovecot-1.2: mail_cache_lock(): Return -1 if locking times out.

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 9 18:34:53 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/5c0c674eae1a
changeset: 8181:5c0c674eae1a
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 09 18:30:23 2008 +0300
description:
mail_cache_lock(): Return -1 if locking times out.
This fixes cache compression starting even when locking timed out.

diffstat:

2 files changed, 5 insertions(+), 4 deletions(-)
src/lib-index/mail-cache-private.h |    4 ++--
src/lib-index/mail-cache.c         |    5 +++--

diffs (30 lines):

diff -r f6838eb4e0e6 -r 5c0c674eae1a src/lib-index/mail-cache-private.h
--- a/src/lib-index/mail-cache-private.h	Tue Sep 09 17:35:39 2008 +0300
+++ b/src/lib-index/mail-cache-private.h	Tue Sep 09 18:30:23 2008 +0300
@@ -220,8 +220,8 @@ struct mail_cache_lookup_iterate_ctx {
 
 int mail_cache_open_and_verify(struct mail_cache *cache);
 
-/* Explicitly lock the cache file. Returns -1 if error, 1 if ok, 0 if we
-   couldn't lock */
+/* Explicitly lock the cache file. Returns -1 if error / timed out,
+   1 if ok, 0 if cache is broken/doesn't exist */
 int mail_cache_lock(struct mail_cache *cache, bool require_same_reset_id);
 /* Returns -1 if cache is / just got corrupted, 0 if ok. */
 int mail_cache_unlock(struct mail_cache *cache);
diff -r f6838eb4e0e6 -r 5c0c674eae1a src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c	Tue Sep 09 17:35:39 2008 +0300
+++ b/src/lib-index/mail-cache.c	Tue Sep 09 18:30:23 2008 +0300
@@ -538,9 +538,10 @@ int mail_cache_lock(struct mail_cache *c
 				break;
 		}
 
-		ret = mail_cache_lock_file(cache);
-		if (ret <= 0)
+		if (mail_cache_lock_file(cache) <= 0) {
+			ret = -1;
 			break;
+		}
 		cache->locked = TRUE;
 
 		if (cache->hdr->file_seq == reset_id ||


More information about the dovecot-cvs mailing list