Commit 2fe60818 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

forking: Always close pid proc before child creation

Child does not know about parent's pid proc fd,
and it can't close it by fd. Next patch will do
close_old_files() optional, and it will base on
the fact there is no leftover fds. So, close pid
proc directly.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent dcac6d66
...@@ -1247,9 +1247,6 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -1247,9 +1247,6 @@ static inline int fork_with_pid(struct pstree_item *item)
BUG_ON(pid != INIT_PID); BUG_ON(pid != INIT_PID);
} }
if (ca.clone_flags & CLONE_FILES)
close_pid_proc();
/* /*
* Some kernel modules, such as netwrok packet generator * Some kernel modules, such as netwrok packet generator
* run kernel thread upon net-namespace creattion taking * run kernel thread upon net-namespace creattion taking
...@@ -1262,6 +1259,7 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -1262,6 +1259,7 @@ static inline int fork_with_pid(struct pstree_item *item)
* The cgroup namespace is also unshared explicitly in the * The cgroup namespace is also unshared explicitly in the
* move_in_cgroup(), so drop this flag here as well. * move_in_cgroup(), so drop this flag here as well.
*/ */
close_pid_proc();
ret = clone_noasan(restore_task_with_children, ret = clone_noasan(restore_task_with_children,
(ca.clone_flags & ~(CLONE_NEWNET | CLONE_NEWCGROUP)) | SIGCHLD, &ca); (ca.clone_flags & ~(CLONE_NEWNET | CLONE_NEWCGROUP)) | SIGCHLD, &ca);
if (ret < 0) { if (ret < 0) {
......
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