ph10 2007/01/22 16:29:55 GMT
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src/src EDITME config.h.defaults deliver.c exim.h
globals.c globals.h readconf.c receive.c
spool_out.c
exim-src/src/transports appendfile.c smtp.c
Log:
Cautiously added ENABLE_DISABLE_FSYNC and disable_fsync, hedged about
with much warning text.
Revision Changes Path
1.457 +4 -0 exim/exim-doc/doc-txt/ChangeLog
1.129 +11 -0 exim/exim-doc/doc-txt/NewStuff
1.20 +16 -0 exim/exim-src/src/EDITME
1.14 +2 -0 exim/exim-src/src/config.h.defaults
1.41 +2 -2 exim/exim-src/src/deliver.c
1.22 +6 -0 exim/exim-src/src/exim.h
1.64 +3 -0 exim/exim-src/src/globals.c
1.45 +3 -0 exim/exim-src/src/globals.h
1.28 +3 -0 exim/exim-src/src/readconf.c
1.33 +1 -1 exim/exim-src/src/receive.c
1.13 +2 -2 exim/exim-src/src/spool_out.c
1.21 +1 -1 exim/exim-src/src/transports/appendfile.c
1.32 +1 -1 exim/exim-src/src/transports/smtp.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.456
retrieving revision 1.457
diff -u -r1.456 -r1.457
--- ChangeLog 22 Jan 2007 15:56:47 -0000 1.456
+++ ChangeLog 22 Jan 2007 16:29:54 -0000 1.457
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.456 2007/01/22 15:56:47 steve Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.457 2007/01/22 16:29:54 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -28,6 +28,10 @@
PH/04 Added gnutls_require_{kx,mac,protocols} to give more control over the
cipher suites used by GnuTLS. These options are ignored by OpenSSL.
+
+PH/05 After discussion on the list, added a compile time option ENABLE_DISABLE_
+ FSYNC, which compiles an option called disable_fsync that allows for
+ bypassing fsync(). The documentation is heavily laced with warnings.
SC/01 Updated eximstats to collate all SpamAssassin rejects into one bucket.
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -r1.128 -r1.129
--- NewStuff 18 Jan 2007 15:35:42 -0000 1.128
+++ NewStuff 22 Jan 2007 16:29:54 -0000 1.129
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.128 2007/01/18 15:35:42 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.129 2007/01/22 16:29:54 ph10 Exp $
New Features in Exim
--------------------
@@ -174,6 +174,17 @@
in a client, the order in the tls_require_ciphers list specifies a
preference order for the cipher algorithms. The first one in the client's
list that is also advertised by the server is tried first.
+
+ 4. There is a new compile-time option called ENABLE_DISABLE_FSYNC. You must
+ not set this option unless you really, really, really understand what you
+ are doing. No pre-compiled distributions of Exim should ever set this
+ option. When it is set, Exim compiles a runtime option called
+ disable_fsync. If this is set true, Exim no longer calls fsync() to force
+ updated files' data to be written to disc. Unexpected events such as
+ crashes and power outages may cause data to be lost or scrambled. Beware.
+
+ When ENABLE_DISABLE_FSYNC is not set, a reference to disable_fsync in a
+ runtime configuration generates an "unknown option" error.
Version 4.66
Index: EDITME
===================================================================
RCS file: /home/cvs/exim/exim-src/src/EDITME,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- EDITME 8 Dec 2006 03:16:48 -0000 1.19
+++ EDITME 22 Jan 2007 16:29:54 -0000 1.20
@@ -1,4 +1,4 @@
-# $Cambridge: exim/exim-src/src/EDITME,v 1.19 2006/12/08 03:16:48 jetmore Exp $
+# $Cambridge: exim/exim-src/src/EDITME,v 1.20 2007/01/22 16:29:54 ph10 Exp $
##################################################
# The Exim mail transport agent #
@@ -1116,5 +1116,21 @@
# messages become "invisible" to the normal management tools.
# SUPPORT_MOVE_FROZEN_MESSAGES=yes
+
+
+#------------------------------------------------------------------------------
+# Disabling the use of fsync(): DO NOT UNCOMMENT THE FOLLOWING LINE unless you
+# really, really, really know what you are doing. And even then, think again.
+# You should never uncomment this when compiling a binary for distribution.
+# Use it only when compiling Exim for your own use.
+#
+# Uncommenting this line enables the use of a runtime option called
+# disable_fsync, which can be used to stop Exim using fsync() to ensure that
+# files are written to disc before proceeding. When this is disabled, crashes
+# and hardware problems such as power outages can cause data to be lost. This
+# feature should only be used in very exceptional circumstances. YOU HAVE BEEN
+# WARNED.
+
+# ENABLE_DISABLE_FSYNC=yes
# End of EDITME for Exim 4.
Index: config.h.defaults
===================================================================
RCS file: /home/cvs/exim/exim-src/src/config.h.defaults,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- config.h.defaults 8 Jan 2007 10:50:17 -0000 1.13
+++ config.h.defaults 22 Jan 2007 16:29:54 -0000 1.14
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/config.h.defaults,v 1.13 2007/01/08 10:50:17 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/config.h.defaults,v 1.14 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -41,6 +41,8 @@
#define DELIVER_IN_BUFFER_SIZE 8192
#define DELIVER_OUT_BUFFER_SIZE 8192
#define DISABLE_D_OPTION
+
+#define ENABLE_DISABLE_FSYNC
#define EXIMDB_DIRECTORY_MODE 0750
#define EXIMDB_LOCK_TIMEOUT 60
Index: deliver.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/deliver.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- deliver.c 8 Jan 2007 10:50:18 -0000 1.40
+++ deliver.c 22 Jan 2007 16:29:54 -0000 1.41
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/deliver.c,v 1.40 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/deliver.c,v 1.41 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -774,7 +774,7 @@
{
BOOL return_output = FALSE;
struct stat statbuf;
- fsync(addr->return_file);
+ (void)EXIMfsync(addr->return_file);
/* If there is no output, do nothing. */
@@ -1979,7 +1979,7 @@
/* Ensure the journal file is pushed out to disk. */
- if (fsync(journal_fd) < 0)
+ if (EXIMfsync(journal_fd) < 0)
log_write(0, LOG_MAIN|LOG_PANIC, "failed to fsync journal: %s",
strerror(errno));
}
Index: exim.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/exim.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- exim.h 8 Jan 2007 10:50:18 -0000 1.21
+++ exim.h 22 Jan 2007 16:29:54 -0000 1.22
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/exim.h,v 1.21 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/exim.h,v 1.22 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -459,6 +459,12 @@
#if defined(USE_READLINE) || defined(EXPAND_DLFUNC)
#include <dlfcn.h>
+#endif
+
+#ifdef ENABLE_DISABLE_FSYNC
+#define EXIMfsync(f) (disable_fsync? 0 : fsync(f))
+#else
+#define EXIMfsync(f) fsync(f)
#endif
/* Backward compatibility; LOOKUP_LSEARCH now includes all three */
Index: globals.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- globals.c 18 Jan 2007 15:35:42 -0000 1.63
+++ globals.c 22 Jan 2007 16:29:54 -0000 1.64
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.c,v 1.63 2007/01/18 15:35:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.c,v 1.64 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -498,6 +498,9 @@
int demime_errorlevel = 0;
int demime_ok = 0;
uschar *demime_reason = NULL;
+#endif
+#ifdef ENABLE_DISABLE_FSYNC
+BOOL disable_fsync = FALSE;
#endif
BOOL disable_ipv6 = FALSE;
BOOL disable_logging = FALSE;
Index: globals.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- globals.h 18 Jan 2007 15:35:42 -0000 1.44
+++ globals.h 22 Jan 2007 16:29:54 -0000 1.45
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.h,v 1.44 2007/01/18 15:35:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.h,v 1.45 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -277,6 +277,9 @@
extern int demime_errorlevel; /* Severity of MIME error */
extern int demime_ok; /* Nonzero if message has been demimed */
extern uschar *demime_reason; /* Reason for broken MIME container */
+#endif
+#ifdef ENABLE_DISABLE_FSYNC
+extern BOOL disable_fsync; /* Not for normal use */
#endif
extern BOOL disable_ipv6; /* Don't do any IPv6 things */
extern BOOL disable_logging; /* Disables log writing when TRUE */
Index: readconf.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/readconf.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- readconf.c 18 Jan 2007 15:35:42 -0000 1.27
+++ readconf.c 22 Jan 2007 16:29:54 -0000 1.28
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/readconf.c,v 1.27 2007/01/18 15:35:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/readconf.c,v 1.28 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -195,6 +195,9 @@
{ "deliver_drop_privilege", opt_bool, &deliver_drop_privilege },
{ "deliver_queue_load_max", opt_fixed, &deliver_queue_load_max },
{ "delivery_date_remove", opt_bool, &delivery_date_remove },
+#ifdef ENABLE_DISABLE_FSYNC
+ { "disable_fsync", opt_bool, &disable_fsync },
+#endif
{ "disable_ipv6", opt_bool, &disable_ipv6 },
{ "dns_again_means_nonexist", opt_stringptr, &dns_again_means_nonexist },
{ "dns_check_names_pattern", opt_stringptr, &check_dns_names_pattern },
Index: receive.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/receive.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- receive.c 8 Jan 2007 10:50:18 -0000 1.32
+++ receive.c 22 Jan 2007 16:29:54 -0000 1.33
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/receive.c,v 1.32 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/receive.c,v 1.33 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2730,7 +2730,7 @@
anything until the terminating dot line is sent. */
if (fflush(data_file) == EOF || ferror(data_file) ||
- fsync(fileno(data_file)) < 0 || (receive_ferror)())
+ EXIMfsync(fileno(data_file)) < 0 || (receive_ferror)())
{
uschar *msg_errno = US strerror(errno);
BOOL input_error = (receive_ferror)() != 0;
Index: spool_out.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/spool_out.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- spool_out.c 8 Jan 2007 10:50:18 -0000 1.12
+++ spool_out.c 22 Jan 2007 16:29:54 -0000 1.13
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/spool_out.c,v 1.12 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/spool_out.c,v 1.13 2007/01/22 16:29:54 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -287,7 +287,7 @@
just pushes it out of C, and fclose() doesn't guarantee to do the write
either. That's just the way Unix works... */
-if (fsync(fileno(f)) < 0)
+if (EXIMfsync(fileno(f)) < 0)
return spool_write_error(where, errmsg, US"sync", temp_name, f);
/* Get the size of the file, and close it. */
@@ -325,7 +325,7 @@
if ((fd = Uopen(temp_name, O_RDONLY|O_DIRECTORY, 0)) < 0)
return spool_write_error(where, errmsg, US"directory open", name, NULL);
-if (fsync(fd) < 0 && errno != EINVAL)
+if (EXIMfsync(fd) < 0 && errno != EINVAL)
return spool_write_error(where, errmsg, US"directory sync", name, NULL);
if (close(fd) < 0)
Index: appendfile.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- appendfile.c 8 Jan 2007 10:50:20 -0000 1.20
+++ appendfile.c 22 Jan 2007 16:29:55 -0000 1.21
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.20 2007/01/08 10:50:20 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.21 2007/01/22 16:29:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2791,7 +2791,7 @@
/* Force out the remaining data to check for any errors; some OS don't allow
fsync() to be called for a FIFO. */
-if (yield == OK && !isfifo && fsync(fd) < 0) yield = DEFER;
+if (yield == OK && !isfifo && EXIMfsync(fd) < 0) yield = DEFER;
/* Update message_size to the accurate count of bytes written, including
added headers. */
Index: smtp.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/smtp.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- smtp.c 18 Jan 2007 15:35:43 -0000 1.31
+++ smtp.c 22 Jan 2007 16:29:55 -0000 1.32
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.31 2007/01/18 15:35:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.32 2007/01/22 16:29:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1690,7 +1690,7 @@
/* Ensure the journal file is pushed out to disk. */
- if (fsync(journal_fd) < 0)
+ if (EXIMfsync(journal_fd) < 0)
log_write(0, LOG_MAIN|LOG_PANIC, "failed to fsync journal: %s",
strerror(errno));
}