* [PATCH user-cr v19-rc1] Revert "restart: coordinator in new pidns to always report status via pipe"
@ 2009-11-19 15:37 Serge E. Hallyn
[not found] ` <20091119153754.GA18377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Serge E. Hallyn @ 2009-11-19 15:37 UTC (permalink / raw)
To: Oren Laadan; +Cc: Linux Containers
Hi Oren,
commit 464ff47b6a1241410f432a55ce4bf93c8bd10861 isn't right. I guess
the problem is that ckpt_coordinator_status(), doesn't do a waitpid
on the global_child_pid? So if I do a 'restart -w --pids', then the
restarted task proceeds just fine, but restart immediately returns.
Maybe the right answer is to modify ckpt_coordinator_status() to
do a waitpid if ctx->args->wait, but just reverting this commit
doesn't seem to have any ill effects - all my default tests pass.
This reverts commit 464ff47b6a1241410f432a55ce4bf93c8bd10861.
---
restart.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/restart.c b/restart.c
index d5d069a..cfc359b 100644
--- a/restart.c
+++ b/restart.c
@@ -994,12 +994,10 @@ static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
ckpt_dbg("forking coordinator in new pidns\n");
/*
- * The coordinator report restart susccess/failure via pipe.
- * (It cannot use return value, because the in the default
- * --wait --copy-status case it is already used to report the
- * root-task's return value).
+ * We won't wait for (collect) the coordinator, so we use a
+ * pipe instead for the coordinator to report success/failure.
*/
- if (pipe(ctx->pipe_coord) < 0) {
+ if (!ctx->args->wait && pipe(ctx->pipe_coord)) {
perror("pipe");
return -1;
}
@@ -1035,7 +1033,10 @@ static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
return -1;
ctx->args->copy_status = copy;
- return ckpt_coordinator_status(ctx);
+ if (ctx->args->wait)
+ return ckpt_collect_child(ctx);
+ else
+ return ckpt_coordinator_status(ctx);
}
#else
static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
@@ -1093,13 +1094,13 @@ static int ckpt_coordinator(struct ckpt_ctx *ctx)
* around and be reaper until all tasks are gone.
* Otherwise, container will die as soon as we exit.
*/
-
- /* Report success/failure to the parent */
- if (write(ctx->pipe_coord[1], &ret, sizeof(ret)) < 0) {
- perror("failed to report status");
- exit(1);
+ if (!ctx->args->wait) {
+ /* report status because parent won't wait for us */
+ if (write(ctx->pipe_coord[1], &ret, sizeof(ret)) < 0) {
+ perror("failed to report status");
+ exit(1);
+ }
}
-
ret = ckpt_pretend_reaper(ctx);
} else if (ctx->args->wait) {
ret = ckpt_collect_child(ctx);
--
1.6.1.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH user-cr v19-rc1] Revert "restart: coordinator in new pidns to always report status via pipe"
[not found] ` <20091119153754.GA18377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-11-19 17:51 ` Oren Laadan
0 siblings, 0 replies; 2+ messages in thread
From: Oren Laadan @ 2009-11-19 17:51 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
The problem is actually elsewhere: ckpt_coordinator_pidns() should
test for args->wait and wait for the coordinator (which became the
pidns's init) before exiting.
Will send a patch soon.
Oren.
Serge E. Hallyn wrote:
> Hi Oren,
>
> commit 464ff47b6a1241410f432a55ce4bf93c8bd10861 isn't right. I guess
> the problem is that ckpt_coordinator_status(), doesn't do a waitpid
> on the global_child_pid? So if I do a 'restart -w --pids', then the
> restarted task proceeds just fine, but restart immediately returns.
>
> Maybe the right answer is to modify ckpt_coordinator_status() to
> do a waitpid if ctx->args->wait, but just reverting this commit
> doesn't seem to have any ill effects - all my default tests pass.
>
> This reverts commit 464ff47b6a1241410f432a55ce4bf93c8bd10861.
> ---
> restart.c | 25 +++++++++++++------------
> 1 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/restart.c b/restart.c
> index d5d069a..cfc359b 100644
> --- a/restart.c
> +++ b/restart.c
> @@ -994,12 +994,10 @@ static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
> ckpt_dbg("forking coordinator in new pidns\n");
>
> /*
> - * The coordinator report restart susccess/failure via pipe.
> - * (It cannot use return value, because the in the default
> - * --wait --copy-status case it is already used to report the
> - * root-task's return value).
> + * We won't wait for (collect) the coordinator, so we use a
> + * pipe instead for the coordinator to report success/failure.
> */
> - if (pipe(ctx->pipe_coord) < 0) {
> + if (!ctx->args->wait && pipe(ctx->pipe_coord)) {
> perror("pipe");
> return -1;
> }
> @@ -1035,7 +1033,10 @@ static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
> return -1;
>
> ctx->args->copy_status = copy;
> - return ckpt_coordinator_status(ctx);
> + if (ctx->args->wait)
> + return ckpt_collect_child(ctx);
> + else
> + return ckpt_coordinator_status(ctx);
> }
> #else
> static int ckpt_coordinator_pidns(struct ckpt_ctx *ctx)
> @@ -1093,13 +1094,13 @@ static int ckpt_coordinator(struct ckpt_ctx *ctx)
> * around and be reaper until all tasks are gone.
> * Otherwise, container will die as soon as we exit.
> */
> -
> - /* Report success/failure to the parent */
> - if (write(ctx->pipe_coord[1], &ret, sizeof(ret)) < 0) {
> - perror("failed to report status");
> - exit(1);
> + if (!ctx->args->wait) {
> + /* report status because parent won't wait for us */
> + if (write(ctx->pipe_coord[1], &ret, sizeof(ret)) < 0) {
> + perror("failed to report status");
> + exit(1);
> + }
> }
> -
> ret = ckpt_pretend_reaper(ctx);
> } else if (ctx->args->wait) {
> ret = ckpt_collect_child(ctx);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-19 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19 15:37 [PATCH user-cr v19-rc1] Revert "restart: coordinator in new pidns to always report status via pipe" Serge E. Hallyn
[not found] ` <20091119153754.GA18377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-19 17:51 ` Oren Laadan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.