[master] 8668010 Try to make epoll waiter work again

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 12 15:32:26 CET 2015


commit 8668010b08b33f2a3b0dc235d53a6774e5e3e12b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 12 14:32:15 2015 +0000

    Try to make epoll waiter work again

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 7d9b17f..a577a0c 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -288,7 +288,11 @@ SES_Wait(struct sess *sp)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	pp = sp->sesspool;
 	CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
-	INIT_OBJ(&sp->waited, WAITED_MAGIC);
+	/*
+	 * XXX: waiter_epoll prevents us from zeroing the struct because
+	 * XXX: it keeps state across calls.
+	 */
+	sp->waited.magic = WAITED_MAGIC;
 	sp->waited.fd = sp->fd;
 	sp->waited.ptr = sp;
 	sp->waited.deadline = sp->t_idle;
diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index fb214b2..2890696 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -75,18 +75,11 @@ vwe_modadd(struct vwe *vwe, int fd, void *data, short arm)
 	 * XXX: will hang. See #644.
 	 */
 	assert(fd >= 0);
-	if (data == vwe->pipes || data == vwe->timer_pipes) {
-		struct epoll_event ev = {
-		    EPOLLIN | EPOLLPRI , { data }
-		};
-		AZ(epoll_ctl(vwe->epfd, arm, fd, &ev));
-	} else {
-		struct waited *sp = (struct waited *)data;
-		CHECK_OBJ_NOTNULL(sp, WAITED_MAGIC);
-		sp->ev.data.ptr = data;
-		sp->ev.events = EPOLLIN | EPOLLPRI | EPOLLONESHOT | EPOLLRDHUP;
-		AZ(epoll_ctl(vwe->epfd, arm, fd, &sp->ev));
-	}
+	assert(data == vwe->pipes || data == vwe->timer_pipes);
+	struct epoll_event ev = {
+	    EPOLLIN | EPOLLPRI , { data }
+	};
+	AZ(epoll_ctl(vwe->epfd, arm, fd, &ev));
 }
 
 static void



More information about the varnish-commit mailing list