r1182 - in branches/1.0: . bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Wed Oct 18 16:27:12 CEST 2006


Author: des
Date: 2006-10-18 16:27:12 +0200 (Wed, 18 Oct 2006)
New Revision: 1182

Modified:
   branches/1.0/
   branches/1.0/bin/varnishd/cache_acceptor_epoll.c
Log:
 r32845 at cat (orig r1143):  des | 2006-10-06 17:37:32 +0200
 On Linux 2.6.8 and older, epoll_ctl(EPOLL_CTL_DEL) requires a poll_event
 even though it is not used, and will return EFAULT if one is not provided.
 
 Also, instead of silently accepting EBADF from epoll_ctl(), check that
 sp->fd != -1 before calling vca_del().  This can happen in some cases
 where vca_pollsession() closes the session before returning.  This way,
 we will still get an assertion failure if epoll_ctl() fails for some
 other (unexpected) reason.
 
 Thanks to airmax for his assistance in tracking this down.



Property changes on: branches/1.0
___________________________________________________________________
Name: svk:merge
   - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1142
   + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1143

Modified: branches/1.0/bin/varnishd/cache_acceptor_epoll.c
===================================================================
--- branches/1.0/bin/varnishd/cache_acceptor_epoll.c	2006-10-18 14:27:11 UTC (rev 1181)
+++ branches/1.0/bin/varnishd/cache_acceptor_epoll.c	2006-10-18 14:27:12 UTC (rev 1182)
@@ -62,10 +62,8 @@
 static void
 vca_del(int fd)
 {
-	int i;
-
-	i = epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL);
-	assert(i == 0 || errno == EBADF);
+	struct epoll_event ev = { 0, { 0 } };
+	AZ(epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev));
 }
 
 static void
@@ -103,7 +101,8 @@
 				i = vca_pollsession(sp);
 				if (i >= 0) {
 					TAILQ_REMOVE(&sesshead, sp, list);
-					vca_del(sp->fd);
+					if (sp->fd != -1)
+						vca_del(sp->fd);
 					if (i == 0)
 						vca_handover(sp, i);
 					else




More information about the varnish-commit mailing list