[07/14] pid_ns: Pass namespace init task to do_create_pid_ns_helper()

Submitted by Kirill Tkhai on May 15, 2017, 1:05 p.m.

Details

Message ID 149485353030.681.1503199472732365869.stgit@localhost.localdomain
State New
Series "Refactor pid_ns helpers creation"
Headers show

Commit Message

Kirill Tkhai May 15, 2017, 1:05 p.m.
This will be used in next patch.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/namespaces.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/namespaces.c b/criu/namespaces.c
index b922d376f..398ff671f 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2622,6 +2622,7 @@  static int pid_ns_helper(struct ns_id *ns, int sk)
 static int do_create_pid_ns_helper(void *arg, int sk, pid_t unused_pid)
 {
 	int pid_ns_fd, mnt_ns_fd, fd, i, lock_fd, transport_fd;
+	struct pstree_item *ns_reaper;
 	struct ns_id *ns, *tmp;
 	struct pid *pid;
 	pid_t child;
@@ -2631,7 +2632,8 @@  static int do_create_pid_ns_helper(void *arg, int sk, pid_t unused_pid)
 		pr_perror("Can't open pid ns");
 		goto err;
 	}
-	ns = *(struct ns_id **)arg;
+	ns_reaper = *(struct pstree_item **)arg;
+	ns = lookup_ns_by_id(ns_reaper->ids->pid_ns_id, &pid_ns_desc);
 
 	fd = fdstore_get(ns->pid.nsfd_id);
 	if (fd < 0) {
@@ -2747,7 +2749,7 @@  int create_pid_ns_helper(struct ns_id *ns)
 	if (sk < 0)
 		return -1;
 
-	if (userns_call(do_create_pid_ns_helper, 0, &ns, sizeof(ns), sk) < 0) {
+	if (userns_call(do_create_pid_ns_helper, 0, &current, sizeof(current), sk) < 0) {
 		pr_err("Can't create pid_ns helper\n");
 		close(sk);
 		return -1;