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 <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-02 14:50:47 +08:00
parent 62ef95ba93
commit 37856283d5
+6 -6
View File
@@ -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);