mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
pstree: Do not populate zero levels of task's pid
If task's pid were hashed before the task itself (this may happen, when another task has sid or pgid equal to this pid), the pid mustn't contain zero levels. So, if pgid or sid has zero levels, we should not add them. Otherwise, session04 --iter 3 fails with: =[log]=> dump/zdtm/static/session04/30/2/restore.log ------------------------ grep Error ------------------------ (01.858187) 6: Restoring children in our session: (01.858206) 6: Forking task with 303 pid (flags 0x600) (01.869893) 1: PID: real 145 virt 15 (01.870247) 1: Forking task with 20 pid (flags 0x0) (01.872948) Error (criu/cr-restore.c:381): 0: Write -1 to sys/kernel/ns_last_pid: Invalid argument (01.873030) Error (criu/namespaces.c:2664): Can't set next pid (01.873103) 1: Error (criu/ns-common.c:46): Error answer (01.873123) 1: Error (criu/cr-restore.c:404): Can't request next pid (01.873135) 1: Error (criu/cr-restore.c:1321): Can't set next pid (01.873310) 1: Error (criu/cr-restore.c:1434): Can't fork for 20: No such file or directory Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Acked-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
0aa9cc3641
commit
3c712e280b
@@ -533,9 +533,9 @@ static struct pid *find_pid_or_place_in_hier(struct rb_node **root, pid_t pid, i
|
||||
static struct pid *lookup_create_pid(pid_t *pid, int level, struct pid *pid_node, int ns_id)
|
||||
{
|
||||
struct rb_node **new = NULL, *parent = NULL;
|
||||
int i, orig_level = level;
|
||||
struct pid *found;
|
||||
struct ns_id *ns;
|
||||
int i;
|
||||
|
||||
ns = lookup_ns_by_id(ns_id, &pid_ns_desc);
|
||||
|
||||
@@ -561,11 +561,11 @@ static struct pid *lookup_create_pid(pid_t *pid, int level, struct pid *pid_node
|
||||
if (!pid_node) {
|
||||
struct pstree_item *item;
|
||||
|
||||
item = __alloc_pstree_item(true, orig_level);
|
||||
item = __alloc_pstree_item(true, level);
|
||||
if (item == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < orig_level; i++)
|
||||
for (i = 0; i < level; i++)
|
||||
item->pid->ns[i].virt = pid[i];
|
||||
pid_node = item->pid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user