[CRIU] [PATCH v3 15/55] pstree: Read ids earlier in read_pstree_image()
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Apr 10 01:17:32 PDT 2017
Read ids before creation of item, then we'll know
pid_ns of the item, so later we will be able to
allocate item with right levels of pid (in next patches).
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/pstree.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/criu/pstree.c b/criu/pstree.c
index 15aaccebe..e12b358a7 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -530,6 +530,7 @@ static int read_pstree_ids(pid_t pid, TaskKobjIdsEntry **ids)
static int read_pstree_image(pid_t *pid_max)
{
+ TaskKobjIdsEntry *ids;
int ret = 0, i;
struct cr_img *img;
struct pstree_item *pi;
@@ -547,12 +548,18 @@ static int read_pstree_image(pid_t *pid_max)
if (ret <= 0)
break;
+ ret = read_pstree_ids(e->pid, &ids);
+ if (ret < 0)
+ break;
+
ret = -1;
pi = lookup_create_item(e->pid);
if (pi == NULL)
break;
BUG_ON(pi->pid->state != TASK_UNDEF);
+ pi->ids = ids;
+
/*
* All pids should be added in the tree to be able to find
* free pid-s for helpers. pstree_item for these pid-s will
@@ -630,10 +637,6 @@ static int read_pstree_image(pid_t *pid_max)
task_entries->nr_tasks++;
pstree_entry__free_unpacked(e, NULL);
-
- ret = read_pstree_ids(vpid(pi), &pi->ids);
- if (ret < 0)
- goto err;
}
if (ret == 0)
More information about the CRIU
mailing list