dovecot-2.2: mdbox: Fix to handling transactions with partially ...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 29 17:55:53 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/19732dd98602
changeset: 15295:19732dd98602
user: Timo Sirainen <tss at iki.fi>
date: Wed Oct 03 01:26:42 2012 +0300
description:
mdbox: Fix to handling transactions with partially failed saves.
diffstat:
src/lib-storage/index/dbox-common/dbox-file.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diffs (28 lines):
diff -r 3de5a5b49580 -r 19732dd98602 src/lib-storage/index/dbox-common/dbox-file.c
--- a/src/lib-storage/index/dbox-common/dbox-file.c Wed Oct 03 01:20:22 2012 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-file.c Wed Oct 03 01:26:42 2012 +0300
@@ -532,7 +532,8 @@
{
struct mail_storage *storage = &ctx->file->storage->storage;
- if (ctx->last_flush_offset == ctx->output->offset)
+ if (ctx->last_flush_offset == ctx->output->offset &&
+ ctx->last_checkpoint_offset == ctx->output->offset)
return 0;
if (o_stream_flush(ctx->output) < 0) {
@@ -540,6 +541,14 @@
return -1;
}
+ if (ctx->last_checkpoint_offset != ctx->output->offset) {
+ if (ftruncate(ctx->file->fd, ctx->last_checkpoint_offset) < 0) {
+ dbox_file_set_syscall_error(ctx->file, "ftruncate()");
+ return -1;
+ }
+ o_stream_seek(ctx->output, ctx->last_checkpoint_offset);
+ }
+
if (storage->set->parsed_fsync_mode != FSYNC_MODE_NEVER) {
if (fdatasync(ctx->file->fd) < 0) {
dbox_file_set_syscall_error(ctx->file, "fdatasync()");
More information about the dovecot-cvs
mailing list