2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

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: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Mike Rapoport
2018-04-16 19:59:03 +03:00
committed by Andrei Vagin
parent dd3704a644
commit 9cb20327aa

View File

@@ -1062,7 +1062,7 @@ static int complete_forks(int epollfd, struct epoll_event **events, int *nr_fds)
struct lazy_pages_info *lpi, *n;
if (list_empty(&pending_lpis))
return 0;
return 1;
list_for_each_entry(lpi, &pending_lpis, l)
(*nr_fds)++;
@@ -1195,12 +1195,15 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
goto out;
if (ret > 0) {
ret = complete_forks(epollfd, &events, &nr_fds);
if (ret)
if (ret < 0)
goto out;
if (!restore_finished)
continue;
}
/* make sure we return success if there is nothing to xfer */
ret = 0;
poll_timeout = 0;
list_for_each_entry_safe(lpi, n, &lpis, l) {
if (!list_empty(&lpi->iovs) && list_empty(&lpi->reqs)) {