Commit 37b99ebe authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

files: Do setup_newborn_fds() later

This patch makes the call of service fds relocation after
root_prepare_shared()->prepare_fd_pid(). Next patches
will make service_fd_base depend on task's max fd used,
and for root_item we need to read all fles to know
the maximum of them.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent d076328c
...@@ -1051,9 +1051,6 @@ static int setup_newborn_fds(struct pstree_item *me) ...@@ -1051,9 +1051,6 @@ static int setup_newborn_fds(struct pstree_item *me)
return -1; return -1;
} }
if (log_init_by_pid(vpid(me)))
return -1;
return 0; return 0;
} }
...@@ -1607,9 +1604,6 @@ static int restore_task_with_children(void *_arg) ...@@ -1607,9 +1604,6 @@ static int restore_task_with_children(void *_arg)
if ( !(ca->clone_flags & CLONE_FILES)) if ( !(ca->clone_flags & CLONE_FILES))
close_safe(&ca->fd); close_safe(&ca->fd);
if (setup_newborn_fds(current))
goto err;
pid = getpid(); pid = getpid();
if (vpid(current) != pid) { if (vpid(current) != pid) {
pr_err("Pid %d do not match expected %d\n", pid, vpid(current)); pr_err("Pid %d do not match expected %d\n", pid, vpid(current));
...@@ -1617,6 +1611,9 @@ static int restore_task_with_children(void *_arg) ...@@ -1617,6 +1611,9 @@ static int restore_task_with_children(void *_arg)
goto err; goto err;
} }
if (log_init_by_pid(vpid(current)))
return -1;
if (current->parent == NULL) { if (current->parent == NULL) {
/* /*
* The root task has to be in its namespaces before executing * The root task has to be in its namespaces before executing
...@@ -1683,6 +1680,9 @@ static int restore_task_with_children(void *_arg) ...@@ -1683,6 +1680,9 @@ static int restore_task_with_children(void *_arg)
goto err; goto err;
} }
if (setup_newborn_fds(current))
goto err;
if (restore_task_mnt_ns(current)) if (restore_task_mnt_ns(current))
goto err; goto err;
......
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