dovecot: Log an error if non-head log file couldn't be synced to...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 20 23:50:45 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/a250c1a48471
changeset: 5792:a250c1a48471
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 20 23:49:44 2007 +0300
description:
Log an error if non-head log file couldn't be synced to the next file's
prev_file_offset position.

diffstat:

1 file changed, 11 insertions(+)
src/lib-index/mail-transaction-log-file.c |   11 +++++++++++

diffs (21 lines):

diff -r 2a05cff7eca4 -r a250c1a48471 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 20:49:51 2007 +0300
+++ b/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 23:49:44 2007 +0300
@@ -748,6 +748,17 @@ mail_transaction_log_file_sync(struct ma
 		}
 		// FIXME: here we probably want to flush NFS data cache
 	}
+
+	if (file->next != NULL &&
+	    file->hdr.file_seq == file->next->hdr.prev_file_seq &&
+	    file->next->hdr.prev_file_offset != file->sync_offset) {
+		mail_index_set_error(file->log->index,
+			"Invalid transaction log size "
+			"(%"PRIuUOFF_T" vs %u): %s", file->sync_offset,
+			file->log->head->hdr.prev_file_offset, file->filepath);
+		return -1;
+	}
+
 	return 0;
 }
 


More information about the dovecot-cvs mailing list