dovecot: If read() returned a partial transaction, don't give an...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 20 02:18:02 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/01c94fef3578
changeset: 5787:01c94fef3578
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 20 02:17:55 2007 +0300
description:
If read() returned a partial transaction, don't give an error because it
could be just that kernel temporarily didn't return the expected data.

diffstat:

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

diffs (21 lines):

diff -r b6cf05796f6d -r 01c94fef3578 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 01:56:39 2007 +0300
+++ b/src/lib-index/mail-transaction-log-file.c	Wed Jun 20 02:17:55 2007 +0300
@@ -727,11 +727,12 @@ mail_transaction_log_file_sync(struct ma
 
 	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) {
+		/* Record goes outside the file we've seen. Unless we're
+		   locked, we can't know if this is expected or not. Even when
+		   we're read()ing the file, the kernel (at least Linux 2.6)
+		   can show the last read memory page updated, but without the
+		   expected next page. */
+		if (file->locked) {
 			if (trans_size != 0) {
 				mail_transaction_log_file_set_corrupted(file,
 					"hdr.size too large (%u)", trans_size);


More information about the dovecot-cvs mailing list