Commit 82668f67 authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

util: epoll_run: fix event processing loop

The number of pending events returned by epoll_wait is overridden by the
first call to an event handler. Using an additional local variable resolves
this issue.

travis-ci: success for lazy-pages: add non-#PF events handling
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent e5b4fcb6
...@@ -1230,7 +1230,7 @@ int epoll_add_rfd(int epfd, struct epoll_rfd *rfd) ...@@ -1230,7 +1230,7 @@ int epoll_add_rfd(int epfd, struct epoll_rfd *rfd)
int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout) int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout)
{ {
int ret = 0, i; int ret, i, nr_events;
while (1) { while (1) {
/* FIXME -- timeout should decrease over time... */ /* FIXME -- timeout should decrease over time... */
...@@ -1243,7 +1243,8 @@ int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout ...@@ -1243,7 +1243,8 @@ int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout
break; break;
} }
for (i = 0; i < ret; i++) { nr_events = ret;
for (i = 0; i < nr_events; i++) {
struct epoll_rfd *rfd; struct epoll_rfd *rfd;
rfd = (struct epoll_rfd *)evs[i].data.ptr; rfd = (struct epoll_rfd *)evs[i].data.ptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment