|
| 1 | +diff --git a/criu/page-xfer.c b/criu/page-xfer.c |
| 2 | +index 0314963e6d..4291d9bc27 100644 |
| 3 | +--- a/criu/page-xfer.c |
| 4 | ++++ b/criu/page-xfer.c |
| 5 | +@@ -279,6 +279,7 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov) |
| 6 | + { |
| 7 | + int ret; |
| 8 | + unsigned long off, end; |
| 9 | ++ struct page_read *curr_parent; |
| 10 | + |
| 11 | + /* |
| 12 | + * Try to find pagemap entry in parent, from which |
| 13 | +@@ -294,21 +295,31 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov) |
| 14 | + while (1) { |
| 15 | + unsigned long pend; |
| 16 | + |
| 17 | +- ret = p->seek_pagemap(p, off); |
| 18 | +- if (ret <= 0 || !p->pe) { |
| 19 | +- pr_err("Missing %lx in parent pagemap\n", off); |
| 20 | +- return -1; |
| 21 | ++ /* Try to find the page in the parent chain */ |
| 22 | ++ curr_parent = p; |
| 23 | ++ while (curr_parent) { |
| 24 | ++ ret = curr_parent->seek_pagemap(curr_parent, off); |
| 25 | ++ if (ret > 0 && curr_parent->pe) { |
| 26 | ++ /* Found it! */ |
| 27 | ++ pr_debug("\tFound %" PRIx64 "/%lu in parent chain\n", |
| 28 | ++ curr_parent->pe->vaddr, pagemap_len(curr_parent->pe)); |
| 29 | ++ pend = curr_parent->pe->vaddr + pagemap_len(curr_parent->pe); |
| 30 | ++ goto found; |
| 31 | ++ } |
| 32 | ++ curr_parent = curr_parent->parent; |
| 33 | + } |
| 34 | + |
| 35 | +- pr_debug("\tFound %" PRIx64 "/%lu\n", p->pe->vaddr, pagemap_len(p->pe)); |
| 36 | ++ /* Not found in any parent */ |
| 37 | ++ pr_err("Missing %lx in parent pagemap chain\n", off); |
| 38 | ++ return -1; |
| 39 | + |
| 40 | ++found: |
| 41 | + /* |
| 42 | + * The pagemap entry in parent may happen to be |
| 43 | + * shorter, than the hole we write. In this case |
| 44 | + * we should go ahead and check the remainder. |
| 45 | + */ |
| 46 | + |
| 47 | +- pend = p->pe->vaddr + pagemap_len(p->pe); |
| 48 | + if (end <= pend) |
| 49 | + return 0; |
0 commit comments