[CRIU] [PATCH 2/2] mm: handle new processes which created between snapshots

Andrey Vagin avagin at openvz.org
Mon Jun 24 08:59:26 EDT 2013


These processes don't have image files in a parent snapshot and crtools
should not fail in this case.

https://bugzilla.openvz.org/show_bug.cgi?id=2636

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mem.c       | 10 +++++++---
 page-read.c |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/mem.c b/mem.c
index d6c807c..3316c4e 100644
--- a/mem.c
+++ b/mem.c
@@ -86,7 +86,7 @@ static struct mem_snap_ctx *mem_snap_init(struct parasite_ctl *ctl)
 
 	pm_fd = open_image_at(p_fd, CR_FD_PAGEMAP, O_RSTR, ctl->pid.virt);
 	if (pm_fd < 0)
-		return ERR_PTR(pm_fd);
+		return ERR_PTR(-errno);
 
 	ctx = xmalloc(sizeof(*ctx));
 	if (!ctx)
@@ -325,8 +325,12 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 	 */
 
 	snap = mem_snap_init(ctl);
-	if (IS_ERR(snap))
-		goto out;
+	if (IS_ERR(snap)) {
+		if (PTR_ERR(snap) == -ENOENT)
+			snap = NULL;
+		else
+			goto out;
+	}
 
 	map = xmalloc(vma_area_list->longest * sizeof(*map));
 	if (!map)
diff --git a/page-read.c b/page-read.c
index 7de69d2..0f9a9cc 100644
--- a/page-read.c
+++ b/page-read.c
@@ -162,7 +162,7 @@ static int try_open_parent(int dfd, int pid, struct page_read *pr)
 	if (!parent)
 		goto err_cl;
 
-	if (open_page_read_at(pfd, pid, parent))
+	if (open_page_read_at(pfd, pid, parent) && errno != ENOENT)
 		goto err_free;
 
 	close(pfd);
-- 
1.8.2.1



More information about the CRIU mailing list