dovecot-1.0: mmap_disable=yes: Fixed invalid "hdr.size too large...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 20 20:51:42 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/98cd45935799
changeset: 5323:98cd45935799
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 20 20:51:38 2007 +0300
description:
mmap_disable=yes: Fixed invalid "hdr.size too large" transaction log
corruption errors.
diffstat:
1 file changed, 11 insertions(+), 6 deletions(-)
src/lib-index/mail-transaction-log.c | 17 +++++++++++------
diffs (30 lines):
diff -r b919a32cd077 -r 98cd45935799 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c Tue Jun 19 14:25:30 2007 +0300
+++ b/src/lib-index/mail-transaction-log.c Wed Jun 20 20:51:38 2007 +0300
@@ -1145,15 +1145,20 @@ mail_transaction_log_file_sync(struct ma
if (file->sync_offset - file->buffer_offset + hdr_size > size)
break;
file->sync_offset += hdr_size;
+ hdr_size = 0;
}
avail = file->sync_offset - file->buffer_offset;
- if (avail != size && avail >= sizeof(*hdr)) {
- /* record goes outside the file we've seen. or if
- we're accessing the log file via unlocked mmaped
- memory, it may be just that the memory was updated
- after we checked the file size. */
- if (file->locked || file->mmap_base == NULL) {
+ if (avail != size) {
+ /* There's more data than we could sync at the moment. If the
+ last record's size wasn't valid, we can't know if it will
+ be updated unless we've locked the log.
+
+ Without locking we can be sure only if we're not using
+ mmaping, because with mmaping the data and the file size
+ can get updated at any time. */
+ if (file->locked ||
+ (hdr_size != 0 && file->mmap_base == NULL)) {
if (hdr_size != 0) {
mail_transaction_log_file_set_corrupted(file,
"hdr.size too large (%u)", hdr_size);
More information about the dovecot-cvs
mailing list