Commit 0a6da43d authored by Pavel Emelyanov's avatar Pavel Emelyanov

rst: Check core near the place read it from image

Doing it several steps further is less clean.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e0b8f914
...@@ -783,7 +783,7 @@ static int restore_one_zombie(int pid, CoreEntry *core) ...@@ -783,7 +783,7 @@ static int restore_one_zombie(int pid, CoreEntry *core)
return -1; return -1;
} }
static int check_core(CoreEntry *core) static int check_core(CoreEntry *core, struct pstree_item *me)
{ {
int ret = -1; int ret = -1;
...@@ -798,7 +798,7 @@ static int check_core(CoreEntry *core) ...@@ -798,7 +798,7 @@ static int check_core(CoreEntry *core)
} }
if (core->tc->task_state != TASK_DEAD) { if (core->tc->task_state != TASK_DEAD) {
if (!core->ids && !current->ids) { if (!core->ids && !me->ids) {
pr_err("Core IDS data missed for non-zombie\n"); pr_err("Core IDS data missed for non-zombie\n");
goto out; goto out;
} }
...@@ -818,11 +818,6 @@ static int restore_one_task(int pid, CoreEntry *core) ...@@ -818,11 +818,6 @@ static int restore_one_task(int pid, CoreEntry *core)
{ {
int ret; int ret;
if (check_core(core)) {
ret = -1;
goto out;
}
switch ((int)core->tc->task_state) { switch ((int)core->tc->task_state) {
case TASK_ALIVE: case TASK_ALIVE:
ret = restore_one_alive_task(pid, core); ret = restore_one_alive_task(pid, core);
...@@ -836,7 +831,6 @@ static int restore_one_task(int pid, CoreEntry *core) ...@@ -836,7 +831,6 @@ static int restore_one_task(int pid, CoreEntry *core)
break; break;
} }
out:
core_entry__free_unpacked(core, NULL); core_entry__free_unpacked(core, NULL);
return ret; return ret;
} }
...@@ -884,6 +878,9 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -884,6 +878,9 @@ static inline int fork_with_pid(struct pstree_item *item)
if (ret < 0) if (ret < 0)
return -1; return -1;
if (check_core(ca.core, item))
return -1;
if (ca.core->tc->task_state == TASK_DEAD) if (ca.core->tc->task_state == TASK_DEAD)
item->parent->rst->nr_zombies++; item->parent->rst->nr_zombies++;
} else } else
......
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