[nginx] svn commit: r4320 - trunk/src/event/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Tue Nov 29 17:27:13 UTC 2011


Author: mdounin
Date: 2011-11-29 17:27:13 +0000 (Tue, 29 Nov 2011)
New Revision: 4320

Log:
Fixed AIO on Linux, broken in r4306.

Events from eventfd do not have c->write set, and the stale event
check added in r4306 causes null pointer dereference.


Modified:
   trunk/src/event/modules/ngx_epoll_module.c

Modified: trunk/src/event/modules/ngx_epoll_module.c
===================================================================
--- trunk/src/event/modules/ngx_epoll_module.c	2011-11-29 17:25:31 UTC (rev 4319)
+++ trunk/src/event/modules/ngx_epoll_module.c	2011-11-29 17:27:13 UTC (rev 4320)
@@ -681,19 +681,19 @@
 
         wev = c->write;
 
-        if (c->fd == -1 || wev->instance != instance) {
+        if ((revents & EPOLLOUT) && wev->active) {
 
-            /*
-             * the stale event from a file descriptor
-             * that was just closed in this iteration
-             */
+            if (c->fd == -1 || wev->instance != instance) {
 
-            ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
-                           "epoll: stale event %p", c);
-            continue;
-        }
+                /*
+                 * the stale event from a file descriptor
+                 * that was just closed in this iteration
+                 */
 
-        if ((revents & EPOLLOUT) && wev->active) {
+                ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+                               "epoll: stale event %p", c);
+                continue;
+            }
 
             if (flags & NGX_POST_THREAD_EVENTS) {
                 wev->posted_ready = 1;



More information about the nginx-devel mailing list