dovecot: If mail_nfs_index=yes, we need to call fdatasync() for ...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 14 23:44:39 EET 2007
details: http://hg.dovecot.org/dovecot/rev/587a9d3054c1
changeset: 6796:587a9d3054c1
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 14 23:43:42 2007 +0200
description:
If mail_nfs_index=yes, we need to call fdatasync() for all written
transactions. Also this fdatasyncing needs to be done after rewriting the
first record's size.
diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
src/lib-index/mail-transaction-log-append.c | 18 ++++++++++--------
diffs (35 lines):
diff -r 407f75ee2598 -r 587a9d3054c1 src/lib-index/mail-transaction-log-append.c
--- a/src/lib-index/mail-transaction-log-append.c Tue Nov 13 06:23:22 2007 +0200
+++ b/src/lib-index/mail-transaction-log-append.c Wed Nov 14 23:43:42 2007 +0200
@@ -104,14 +104,6 @@ static int log_buffer_write(struct log_a
file->sync_offset + ctx->output->used ==
file->max_tail_offset);
- if (want_fsync && !file->log->index->fsync_disable &&
- fdatasync(file->fd) < 0) {
- mail_index_file_set_syscall_error(file->log->index,
- file->filepath,
- "fdatasync()");
- return log_buffer_move_to_memory(ctx);
- }
-
/* now that the whole transaction has been written, rewrite the first
record's size so the transaction becomes visible */
if (pwrite_full(file->fd, &ctx->first_append_size,
@@ -120,6 +112,16 @@ static int log_buffer_write(struct log_a
file->filepath,
"pwrite_full()");
return log_buffer_move_to_memory(ctx);
+ }
+
+ if ((want_fsync && !file->log->index->fsync_disable) ||
+ file->log->index->nfs_flush) {
+ if (fdatasync(file->fd) < 0) {
+ mail_index_file_set_syscall_error(file->log->index,
+ file->filepath,
+ "fdatasync()");
+ return log_buffer_move_to_memory(ctx);
+ }
}
/* FIXME: when we're relying on O_APPEND and someone else wrote a
More information about the dovecot-cvs
mailing list