dovecot-1.1: If physical/virtual size is in both cache and in fi...

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 10 05:45:20 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/7173d502b4e6
changeset: 7399:7173d502b4e6
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 10 05:45:16 2008 +0200
description:
If physical/virtual size is in both cache and in filename/uidlist, mark the
cache corrupted if they don't match.

diffstat:

1 file changed, 13 insertions(+), 1 deletion(-)
src/lib-storage/index/maildir/maildir-mail.c |   14 +++++++++++++-

diffs (24 lines):

diff -r 705afa37b818 -r 7173d502b4e6 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Mon Mar 10 05:41:18 2008 +0200
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Mon Mar 10 05:45:16 2008 +0200
@@ -270,7 +270,19 @@ maildir_handle_size_caching(struct index
 
 	if (quick_check && maildir_quick_size_lookup(mail, vsize, &size) > 0) {
 		/* already in filename / uidlist. don't add it anywhere,
-		   including to the uidlist if it's already in filename. */
+		   including to the uidlist if it's already in filename.
+		   do some extra checks here to catch potential cache bugs. */
+		if (vsize && mail->data.virtual_size != size) {
+			mail_cache_set_corrupted(mail->ibox->cache,
+				"Corrupted virtual size: "
+				"%"PRIuUOFF_T" != %"PRIuUOFF_T,
+				mail->data.virtual_size, size);
+		} else if (!vsize && mail->data.physical_size != size) {
+			mail_cache_set_corrupted(mail->ibox->cache,
+				"Corrupted phycaisl size: "
+				"%"PRIuUOFF_T" != %"PRIuUOFF_T,
+				mail->data.physical_size, size);
+		}
 		mail->data.dont_cache_fetch_fields |= field;
 		return;
 	}


More information about the dovecot-cvs mailing list