Commit 312e97f1 authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: return to epoll_wait after completing forks

If we get fork() event just before transferring last IOV of the parent
process, continuing to background fetch after completing fork event
handling will cause lazy-pages daemon to exit and nothing will monitor the
child process memory.
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent b6917ef4
...@@ -1062,7 +1062,7 @@ static int complete_forks(int epollfd, struct epoll_event **events, int *nr_fds) ...@@ -1062,7 +1062,7 @@ static int complete_forks(int epollfd, struct epoll_event **events, int *nr_fds)
struct lazy_pages_info *lpi, *n; struct lazy_pages_info *lpi, *n;
if (list_empty(&pending_lpis)) if (list_empty(&pending_lpis))
return 0; return 1;
list_for_each_entry(lpi, &pending_lpis, l) list_for_each_entry(lpi, &pending_lpis, l)
(*nr_fds)++; (*nr_fds)++;
...@@ -1195,12 +1195,15 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds) ...@@ -1195,12 +1195,15 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
goto out; goto out;
if (ret > 0) { if (ret > 0) {
ret = complete_forks(epollfd, &events, &nr_fds); ret = complete_forks(epollfd, &events, &nr_fds);
if (ret) if (ret < 0)
goto out; goto out;
if (!restore_finished) if (!restore_finished)
continue; continue;
} }
/* make sure we return success if there is nothing to xfer */
ret = 0;
poll_timeout = 0; poll_timeout = 0;
list_for_each_entry_safe(lpi, n, &lpis, l) { list_for_each_entry_safe(lpi, n, &lpis, l) {
if (!list_empty(&lpi->iovs) && list_empty(&lpi->reqs)) { if (!list_empty(&lpi->iovs) && list_empty(&lpi->reqs)) {
......
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