dovecot-2.0: lib-index: Index alloc cache fixes. It wasn't reall...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 9 16:08:03 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/131436a6b8b3
changeset: 10878:131436a6b8b3
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 09 16:08:00 2010 +0200
description:
lib-index: Index alloc cache fixes. It wasn't really working.

diffstat:

 src/lib-index/mail-index-alloc-cache.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (35 lines):

diff -r f1a2a8097903 -r 131436a6b8b3 src/lib-index/mail-index-alloc-cache.c
--- a/src/lib-index/mail-index-alloc-cache.c	Tue Mar 09 15:12:53 2010 +0200
+++ b/src/lib-index/mail-index-alloc-cache.c	Tue Mar 09 16:08:00 2010 +0200
@@ -144,6 +144,7 @@
 static void destroy_unrefed(bool all)
 {
 	struct mail_index_alloc_cache_list **list, *rec;
+	bool seen_ref0 = FALSE;
 
 	for (list = &indexes; *list != NULL;) {
 		rec = *list;
@@ -153,11 +154,13 @@
 			*list = rec->next;
 			mail_index_alloc_cache_list_free(rec);
 		} else {
+			if (rec->refcount == 0)
+				seen_ref0 = TRUE;
 			list = &(*list)->next;
 		}
 	}
 
-	if (indexes == NULL && to_index != NULL)
+	if (!seen_ref0 && to_index != NULL)
 		timeout_remove(&to_index);
 }
 
@@ -214,6 +217,8 @@
 			list->index_dir_ino = st.st_ino;
 			list->index_dir_dev = st.st_dev;
 		}
+	}
+	if (list != NULL) {
 		/* keep it referenced for ourself */
 		index->open_count++;
 	}


More information about the dovecot-cvs mailing list