[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-uidlist.c, 1.41, 1.42

tss at dovecot.org tss at dovecot.org
Sun Dec 17 16:35:35 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv18658/src/lib-storage/index/dbox

Modified Files:
	dbox-uidlist.c 
Log Message:
Added fsync_disable setting. Also added missing fsync()ing to dbox when
saving mails.



Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- dbox-uidlist.c	12 Nov 2006 20:04:54 -0000	1.41
+++ dbox-uidlist.c	17 Dec 2006 16:35:33 -0000	1.42
@@ -806,6 +806,7 @@
 static int
 dbox_uidlist_write_append_offsets(struct dbox_uidlist_append_ctx *ctx)
 {
+	struct mail_storage *storage = STORAGE(ctx->uidlist->mbox->storage);
 	struct dbox_save_file *const *files;
         struct dbox_file_header hdr;
 	unsigned int i, count;
@@ -813,6 +814,16 @@
 
 	files = array_get(&ctx->files, &count);
 	for (i = 0; i < count; i++) {
+		if (!ctx->uidlist->mbox->ibox.fsync_disable) {
+			if (fsync(files[i]->file->fd) < 0) {
+				mail_storage_set_critical(storage,
+							"fsync(%s) failed: %m",
+							files[i]->file->path);
+				ret = -1;
+				continue;
+			}
+		}
+
 		DEC2HEX(hdr.append_offset_hex,
 			files[i]->file->output->offset);
 
@@ -820,10 +831,9 @@
 				sizeof(hdr.append_offset_hex),
 				offsetof(struct dbox_file_header,
 					 append_offset_hex)) < 0) {
-			mail_storage_set_critical(
-				STORAGE(ctx->uidlist->mbox->storage),
-				"pwrite_full(%s) failed: %m",
-				files[i]->file->path);
+			mail_storage_set_critical(storage,
+						  "pwrite_full(%s) failed: %m",
+						  files[i]->file->path);
 			ret = -1;
 		}
 	}



More information about the dovecot-cvs mailing list