[CRIU] [PATCH 3/4] lazy-pages: reset poll_timeout to 0 as soon as restore is finished

Mike Rapoport rppt at linux.vnet.ibm.com
Tue May 15 23:42:24 MSK 2018


It is possible that notification about restore finish arrives at the same
time with a fork event. In such case we return to epoll_run_rfds without
resetting the poll_timeout and then we'll keep polling for events
indefinitely. To avoid this, we reset the poll_timeout to 0 as soon as we
know that restore is finished.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/uffd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index 3fbc5c4..468c312 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -1231,6 +1231,8 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
 			ret = complete_forks(epollfd, &events, &nr_fds);
 			if (ret < 0)
 				goto out;
+			if (restore_finished)
+				poll_timeout = 0;
 			if (!restore_finished || !ret)
 				continue;
 		}
@@ -1238,7 +1240,6 @@ static int handle_requests(int epollfd, struct epoll_event *events, int nr_fds)
 		/* 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)) {
 				ret = xfer_pages(lpi);
-- 
2.7.4



More information about the CRIU mailing list