summaryrefslogtreecommitdiff
path: root/source4/lib/events/events_epoll.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-02-06 04:43:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:41 -0500
commitb9f10ebb99a76820085af514b102ff75a5694c57 (patch)
tree50d771fa7cd70c41cf133f6570700d036b41fcc6 /source4/lib/events/events_epoll.c
parent96325d3f763a470272c3b4373afa96f6d54f37b9 (diff)
downloadsamba-b9f10ebb99a76820085af514b102ff75a5694c57.tar.gz
samba-b9f10ebb99a76820085af514b102ff75a5694c57.tar.bz2
samba-b9f10ebb99a76820085af514b102ff75a5694c57.zip
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)
Diffstat (limited to 'source4/lib/events/events_epoll.c')
-rw-r--r--source4/lib/events/events_epoll.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c
index efcbb97f0b..58eeb08cd5 100644
--- a/source4/lib/events/events_epoll.c
+++ b/source4/lib/events/events_epoll.c
@@ -204,7 +204,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
int ret, i;
#define MAXEVENTS 8
struct epoll_event events[MAXEVENTS];
- uint32_t destruction_count = epoll_ev->destruction_count;
+ uint32_t destruction_count = ++epoll_ev->destruction_count;
int timeout = -1;
if (epoll_ev->epoll_fd == -1) return -1;