From b9f10ebb99a76820085af514b102ff75a5694c57 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 6 Feb 2007 04:43:48 +0000 Subject: r21171: fixed a bug related to recursive event handling. If this happens: - two sockets are readable, and select/epoll/aio returns both of them - read event on socket1 is called - inside that read event an event_loop_once is called, this returns that socket2 is readable - read event on socket2 is called - event_loop_once returns - top level event handler then calls read event on socket2 (as it still has that listed as readable) - read handler for socket2 returns zero byte read, which is interpreted as end of file - socket is incorrectly closed this happened with ctdb, but it could happen anywhere (just rarely). The fix is trivial - ensure we break out of the event loop when we have been called recursively. (This used to be commit e042002bb5ee8974220e1ade56b64389571f75a6) --- source4/lib/events/events_aio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/events/events_aio.c') diff --git a/source4/lib/events/events_aio.c b/source4/lib/events/events_aio.c index cd3c32a9b8..90d4bdcc1f 100644 --- a/source4/lib/events/events_aio.c +++ b/source4/lib/events/events_aio.c @@ -219,7 +219,7 @@ static int setup_epoll_wait(struct aio_event_context *aio_ev) static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tvalp) { int ret, i; - uint32_t destruction_count = aio_ev->destruction_count; + uint32_t destruction_count = ++aio_ev->destruction_count; struct timespec timeout; struct io_event events[8]; -- cgit