Commit 2ad16d4c authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: handle_requests: fix return value propagation

When we return from epoll_run_rfds with positive return value it means that
event handling loop was interrupted because the event should be handled
outside of that loop. Is always the case with UFFD_EVENT_FORK.

It may happen that the event occurred after we've completed the memory
transfer and we are on the way to successful return from the
handle_requests() function, but instead of returning 0 we will return the
positive value we've got from epoll_run_rfds.

Explicitly assigning return value of complete_forks() fixes this issue.
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 315c4418
......@@ -1150,8 +1150,9 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
if (ret < 0)
goto out;
if (ret > 0) {
if (complete_forks(epollfd, &events, &nr_fds))
return -1;
ret = complete_forks(epollfd, &events, &nr_fds);
if (ret)
goto out;
if (!restore_finished)
continue;
}
......
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