[CRIU] [PATCH 09/11] lazy-pages: make complete_forks more robust

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Mar 25 16:27:29 MSK 2018


The complete_forks function presumes that it always has a work to do
because we assume that fork event is the only case when we drop out of
epoll_run_rfds with positive return value.

Teach complete_forks to bail out when there is no pending forks to process
to allow exiting epoll_run_rfds for different reasons.

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

diff --git a/criu/uffd.c b/criu/uffd.c
index 14a7ab4..45c1df5 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -965,6 +965,9 @@ 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;
+
 	list_for_each_entry(lpi, &pending_lpis, l)
 		(*nr_fds)++;
 
-- 
2.7.4



More information about the CRIU mailing list