[CRIU] [PATCH] page-xfer: repair bug with check_pagehole_in_parent

Tikhomirov Pavel snorcht at gmail.com
Fri Apr 18 02:50:59 PDT 2014


1)it didn't find real pages it had only one step into iterative snapshots
but what if real page is on the third level?

patch adds recoursive check in previous images

2)it did provide whole intersected pagemap, but it will be more
convinient to print only intersection part.

Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 page-xfer.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/page-xfer.c b/page-xfer.c
index 56e8575..0678b54 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -504,7 +504,7 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
 	off = (unsigned long)iov->iov_base;
 	end = off + iov->iov_len;
 	while (1) {
-		struct iovec piov;
+		struct iovec piov, tiov;
 		unsigned long pend;
 
 		ret = seek_pagemap_page(p, off, true);
@@ -512,7 +512,20 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
 			return -1;
 
 		pagemap2iovec(p->pe, &piov);
-		pr_debug("\tFound %p/%zu\n", piov.iov_base, piov.iov_len);
+		pend = (unsigned long)piov.iov_base + piov.iov_len;
+
+		tiov.iov_base = (void*)off;
+		tiov.iov_len = min(pend, end) - off;
+		if (!p->pe->in_parent) {
+			pr_debug("\tFound %p/%zu\n", tiov.iov_base, tiov.iov_len);
+		} else {
+			if (p->parent)
+				check_pagehole_in_parent(p->parent, &tiov);
+			else {
+				pr_err("No parent, though pagemap is in_parent");
+				return -1;
+			}
+		}
 
 		/*
 		 * The pagemap entry in parent may heppen to be
@@ -520,7 +533,6 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
 		 * we should go ahead and check the remainder.
 		 */
 
-		pend = (unsigned long)piov.iov_base + piov.iov_len;
 		if (end <= pend)
 			return 0;
 
-- 
1.8.3.2



More information about the CRIU mailing list