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

Andrey Vagin avagin at openvz.org
Tue Jun 25 14:27:09 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

v2: return NULL from mem_snap_init, if a parent image is absent.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mem.c       | 5 ++++-
 page-read.c | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/mem.c b/mem.c
index d6c807c..50b34ea 100644
--- a/mem.c
+++ b/mem.c
@@ -85,8 +85,11 @@ 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)
+	if (pm_fd < 0) {
+		if (errno == ENOENT)
+			return NULL;
 		return ERR_PTR(pm_fd);
+	}
 
 	ctx = xmalloc(sizeof(*ctx));
 	if (!ctx)
diff --git a/page-read.c b/page-read.c
index 7de69d2..4e23e09 100644
--- a/page-read.c
+++ b/page-read.c
@@ -162,8 +162,12 @@ 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))
-		goto err_free;
+	if (open_page_read_at(pfd, pid, parent)) {
+		if (errno != ENOENT)
+			goto err_free;
+		xfree(parent);
+		parent = NULL;
+	}
 
 	close(pfd);
 out:
-- 
1.8.3.1



More information about the CRIU mailing list