Commit dd38ae16 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mm: handle new processes which created between snapshots (v2)

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: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 538e87ca
......@@ -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)
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment