On Fri, 2009-10-16 at 22:16 +0400, Kostik wrote:
> TS> Oh, it fails too late. Does this help?
> TS> http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
> 
> It helped, but only half:
> ---
> close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded

This was again the only error? It's still failing too late. It should be
failing in fdatasync() earlier. What does it log with attached patch?
diff -r ebb2a91e6df7 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c	Fri Oct 16 13:16:07 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-save.c	Fri Oct 16 14:16:23 2009 -0400
@@ -722,8 +722,11 @@
 	if (ctx->output != NULL)
 		o_stream_flush(ctx->output);
 
-	if (ftruncate(ctx->mbox->mbox_fd, (off_t)ctx->append_offset) < 0)
+	i_warning("truncating output to %d", (int)ctx->append_offset);
+	if (ftruncate(ctx->mbox->mbox_fd, (off_t)ctx->append_offset) < 0) {
+		i_warning("ftruncate() failed: %m");
 		mbox_set_syscall_error(ctx->mbox, "ftruncate()");
+	}
 }
 
 int mbox_transaction_save_commit(struct mbox_save_context *ctx)
@@ -773,10 +776,16 @@
 	if (mbox->mbox_fd != -1 && !mbox->mbox_writeonly &&
 	    !mbox->ibox.fsync_disable) {
 		if (fdatasync(mbox->mbox_fd) < 0) {
+			i_warning("fdatasync() failed: %m");
 			mbox_set_syscall_error(mbox, "fdatasync()");
 			mbox_save_truncate(ctx);
 			ret = -1;
+		} else {
+			i_warning("fdatasync() succeeded");
 		}
+	} else {
+		i_warning("fdatasync() not being done, fd=%d writeonly=%d fsync_disable=%d",
+			  mbox->mbox_fd, mbox->mbox_writeonly, mbox->ibox.fsync_disable);
 	}
 
 	mbox_transaction_save_deinit(ctx);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to