[CRIU] [PATCH] lazy-pages: uffd_zero: igore -EEXIST error

Mike Rapoport rppt at linux.vnet.ibm.com
Wed Sep 13 21:13:11 MSK 2017


The UFFDIO_ZEROPAGE returns -EEXIST when the page is already mapped. This
may happen when a page fault processing races with handle_remaining_pages.

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

diff --git a/criu/uffd.c b/criu/uffd.c
index 80cc8d1..34ca41e 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -1007,9 +1007,15 @@ static int uffd_zero(struct lazy_pages_info *lpi, __u64 address, int nr_pages)
 	lp_debug(lpi, "zero page at 0x%llx\n", address);
 	rc = ioctl(lpi->lpfd.fd, UFFDIO_ZEROPAGE, &uffdio_zeropage);
 	if (rc) {
-		lp_perror(lpi, "zero page failed: %Ld",
-			  uffdio_zeropage.zeropage);
-		return -1;
+		if (errno == ENOSPC) {
+			handle_exit(lpi);
+			return 0;
+		}
+		if (uffdio_zeropage.zeropage != -EEXIST) {
+			lp_perror(lpi, "zero page failed: %Ld",
+				  uffdio_zeropage.zeropage);
+			return -1;
+		}
 	}
 
 	return 0;
-- 
2.7.4



More information about the CRIU mailing list