httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r992689 - in /httpd/httpd/trunk: CHANGES docs/conf/httpd.conf.in docs/manual/mod/core.xml docs/manual/upgrading.xml include/http_core.h modules/cache/mod_disk_cache.c modules/test/mod_dialup.c server/core.c
Date Sat, 04 Sep 2010 21:53:06 GMT
Author: sf
Date: Sat Sep  4 21:53:06 2010
New Revision: 992689

URL: http://svn.apache.org/viewvc?rev=992689&view=rev
Log:
Disable sendfile by default, as discussed at
http://mail-archives.apache.org/mod_mbox/httpd-dev/201007.mbox/<4C4355EE.2060605@rowe-clan.net>

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/conf/httpd.conf.in
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/docs/manual/upgrading.xml
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/modules/cache/mod_disk_cache.c
    httpd/httpd/trunk/modules/test/mod_dialup.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Sep  4 21:53:06 2010
@@ -2,6 +2,8 @@
 
 Changes with Apache 2.3.9
 
+  *) core: Disable sendfile by default. [Stefan Fritsch]
+
   *) mod_cache: Check the request to determine whether we are allowed
      to return cached content at all, and respect a "Cache-Control:
      no-cache" header from a client. Previously, "no-cache" would

Modified: httpd/httpd/trunk/docs/conf/httpd.conf.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/httpd.conf.in?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/conf/httpd.conf.in (original)
+++ httpd/httpd/trunk/docs/conf/httpd.conf.in Sat Sep  4 21:53:06 2010
@@ -343,14 +343,15 @@ LogLevel warn
 
 #
 # EnableMMAP and EnableSendfile: On systems that support it, 
-# memory-mapping or the sendfile syscall is used to deliver
+# memory-mapping or the sendfile syscall may be used to deliver
 # files.  This usually improves server performance, but must
 # be turned off when serving from networked-mounted 
 # filesystems or if support for these functions is otherwise
 # broken on your system.
+# Defaults: EnableMMAP On, EnableSendfile Off
 #
 #EnableMMAP off
-#EnableSendfile off
+#EnableSendfile on
 
 # Supplemental configuration
 #

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Sat Sep  4 21:53:06 2010
@@ -820,12 +820,13 @@ Locations</a></seealso>
 <name>EnableSendfile</name>
 <description>Use the kernel sendfile support to deliver files to the client</description>
 <syntax>EnableSendfile On|Off</syntax>
-<default>EnableSendfile On</default>
+<default>EnableSendfile Off</default>
 <contextlist><context>server config</context><context>virtual host</context>
 <context>directory</context><context>.htaccess</context>
 </contextlist>
 <override>FileInfo</override>
-<compatibility>Available in version 2.0.44 and later</compatibility>
+<compatibility>Available in version 2.0.44 and later. Default changed to Off in
+version 2.3.9.</compatibility>
 
 <usage>
     <p>This directive controls whether <program>httpd</program> may use
the
@@ -850,19 +851,19 @@ Locations</a></seealso>
     <li>On Linux on Itanium, sendfile may be unable to handle files
     over 2GB in size.</li>
     <li>With a network-mounted <directive
-    module="core">DocumentRoot</directive> (e.g., NFS or SMB),
+    module="core">DocumentRoot</directive> (e.g., NFS, SMB, CIFS, FUSE),
     the kernel may be unable to serve the network file through
     its own cache.</li>
     </ul>
 
-    <p>For server configurations that are vulnerable to these problems,
-    you should disable this feature by specifying:</p>
+    <p>For server configurations that are not vulnerable to these problems,
+    you may enable this feature by specifying:</p>
 
     <example>
-      EnableSendfile Off
+      EnableSendfile On
     </example>
 
-    <p>For NFS or SMB mounted files, this feature may be disabled explicitly
+    <p>For network mounted files, this feature may be disabled explicitly
     for the offending files by specifying:</p>
 
     <example>

Modified: httpd/httpd/trunk/docs/manual/upgrading.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/upgrading.xml?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/upgrading.xml (original)
+++ httpd/httpd/trunk/docs/manual/upgrading.xml Sat Sep  4 21:53:06 2010
@@ -173,6 +173,9 @@
         settings to replace it in 2.4.
         </li>
 
+        <li><directive module="core">EnableSendfile</directive> now
+        defaults to Off.</li>
+
         <li><module>mod_log_config</module>: <a
         href="modules/mod_log_config.html#formats">${cookie}C</a>
         matches whole cookie names.  Previously any substring would

Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Sat Sep  4 21:53:06 2010
@@ -525,7 +525,7 @@ typedef struct {
 #define ENABLE_SENDFILE_OFF    (0)
 #define ENABLE_SENDFILE_ON     (1)
 #define ENABLE_SENDFILE_UNSET  (2)
-    unsigned int enable_sendfile : 2;  /* files in this dir can be mmap'ed */
+    unsigned int enable_sendfile : 2;  /* files in this dir can be sendfile'ed */
     unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being
                                              * pitched indiscriminately */
 
@@ -540,6 +540,10 @@ typedef struct {
     struct ap_logconf *log;
 } core_dir_config;
 
+/* macro to implement off by default behaviour */
+#define AP_SENDFILE_ENABLED(x) \
+    ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
+
 /* Per-server core configuration */
 
 typedef struct {

Modified: httpd/httpd/trunk/modules/cache/mod_disk_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_disk_cache.c?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Sat Sep  4 21:53:06 2010
@@ -487,8 +487,7 @@ static int open_entity(cache_handle_t *h
      * configuration, so this check only takes the globel setting of
      * the EnableSendFile directive into account.
      */
-    flags |= ((coreconf->enable_sendfile == ENABLE_SENDFILE_OFF)
-              ? 0 : APR_SENDFILE_ENABLED);
+    flags |= AP_SENDFILE_ENABLED(coreconf->enable_sendfile);
 #endif
     rc = apr_file_open(&dobj->fd, dobj->datafile, flags, 0, r->pool);
     if (rc != APR_SUCCESS) {

Modified: httpd/httpd/trunk/modules/test/mod_dialup.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/test/mod_dialup.c?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/test/mod_dialup.c (original)
+++ httpd/httpd/trunk/modules/test/mod_dialup.c Sat Sep  4 21:53:06 2010
@@ -161,8 +161,7 @@ dialup_handler(request_rec *r)
 
     rv = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY
 #if APR_HAS_SENDFILE
-                           | ((ccfg->enable_sendfile == ENABLE_SENDFILE_OFF)
-                              ? 0 : APR_SENDFILE_ENABLED)
+                           | AP_SENDFILE_ENABLED(ccfg->enable_sendfile)
 #endif
                        , 0, r->pool);
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=992689&r1=992688&r2=992689&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Sat Sep  4 21:53:06 2010
@@ -3537,8 +3537,7 @@ static int default_handler(request_rec *
 
         if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY
 #if APR_HAS_SENDFILE
-                            | ((d->enable_sendfile == ENABLE_SENDFILE_OFF)
-                                                ? 0 : APR_SENDFILE_ENABLED)
+                            | AP_SENDFILE_ENABLED(d->enable_sendfile)
 #endif
                                     , 0, r->pool)) != APR_SUCCESS) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,



Mime
View raw message