From 37856283d5be92a1968cce6a067608b903f21829 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Fri, 2 Sep 2016 14:48:30 +0800 Subject: [PATCH] ensure the mnt_ns opened before the process exit quote of the log: > open container mount ns failed: No such file or directory > start containers failed the process exits when hyper_enter_sandbox(), so we have to move the wait before hyper_enter_sandbox(). Signed-off-by: Lai Jiangshan --- src/container.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/container.c b/src/container.c index 078accd..36063da 100644 --- a/src/container.c +++ b/src/container.c @@ -507,6 +507,12 @@ static int hyper_setup_container_rootfs(void *data) int setup_dns; uint32_t type; + /* wait for ns-opened ready message */ + if (hyper_get_type(arg->pipens[0], &type) < 0 || type != READY) { + fprintf(stderr, "wait for /proc/self/ns/mnt opened failed\n"); + goto fail; + } + if (hyper_enter_sandbox(arg->pod, -1) < 0) { perror("enter sandbox failed"); goto fail; @@ -626,12 +632,6 @@ static int hyper_setup_container_rootfs(void *data) goto fail; } - /* wait for ns-opened ready message */ - if (hyper_get_type(arg->pipens[0], &type) < 0 || type != READY) { - fprintf(stderr, "wait for /proc/self/ns/mnt opened failed\n"); - goto fail; - } - hyper_send_type(arg->pipe[1], READY); fflush(NULL); _exit(0);