[CRIU] [PATCH] lazy-pages: don't close page-read for child processes

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Jun 25 09:58:55 MSK 2017


The page-read for child process is a shallow copy of the parent process
page-read. They share the open file descriptors and the pagemap.
The lpi_fini of the child processes should not release any resources, they
all will be released during lpi_fini of the parent process.

Fixes: #326

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

diff --git a/criu/uffd.c b/criu/uffd.c
index 41d5d32..d631f4b 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -130,14 +130,13 @@ static void free_lazy_iovs(struct lazy_pages_info *lpi)
 
 static void lpi_fini(struct lazy_pages_info *lpi)
 {
-
 	if (!lpi)
 		return;
 	free(lpi->buf);
 	free_lazy_iovs(lpi);
 	if (lpi->lpfd.fd > 0)
 		close(lpi->lpfd.fd);
-	if (lpi->pr.close)
+	if (!lpi->parent && lpi->pr.close)
 		lpi->pr.close(&lpi->pr);
 	free(lpi);
 }
-- 
2.7.4



More information about the CRIU mailing list