Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] c/r: coordinator to report correct error on restart failure
Date: Mon, 26 Oct 2009 13:35:31 -0500	[thread overview]
Message-ID: <20091026183531.GJ23564@us.ibm.com> (raw)
In-Reply-To: <1256509416-3897-1-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>

Quoting Oren Laadan (orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org):
> If restart fails it is usually due to an error for a restoring task,
> which is place in ctx->errno. Then the coordinator wakes up and sees
> an -EINTR.
> 
> This patch changes the coordinator's behavior to report the error
> value placed in ctx->errno (if an error occurred) rather than report
> a confusing -EINTR.
> 
> Signed-off-by: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>

Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

> ---
>  checkpoint/restart.c |   15 +++++++++++++--
>  1 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/checkpoint/restart.c b/checkpoint/restart.c
> index 5daadc4..9b75de8 100644
> --- a/checkpoint/restart.c
> +++ b/checkpoint/restart.c
> @@ -711,7 +711,7 @@ static inline int is_task_active(struct ckpt_ctx *ctx, pid_t pid)
>  }
> 
>  /* should not be called under write_lock_irq(&tasklist_lock) */
> -static inline void _restore_notify_error(struct ckpt_ctx *ctx, int errno)
> +static void _restore_notify_error(struct ckpt_ctx *ctx, int errno)
>  {
>  	/* first to fail: notify everyone (racy but harmless) */
>  	if (!ckpt_test_ctx_error(ctx)) {
> @@ -1263,9 +1263,20 @@ static int do_restore_coord(struct ckpt_ctx *ctx, pid_t pid)
>  		post_restore_task();
> 
>  	restore_debug_error(ctx, ret);
> -	if (ret < 0) {
> +
> +	if (ret < 0)
>  		ckpt_set_ctx_error(ctx, ret);
> +
> +	if (ckpt_test_ctx_error(ctx)) {
>  		destroy_descendants(ctx);
> +		/*
> +		 * If a restaring task (or we) reported an error, that set
> +		 * out return value to that error. (Need the unlikely loop
> +		 * because the error is recorded after the flag is set).
> +		 */
> +		while (!ctx->errno)
> +			yield();
> +		ret = ctx->errno;
>  	} else {
>  		ckpt_set_ctx_success(ctx);
>  		wake_up_all(&ctx->waitq);
> -- 
> 1.6.0.4
> 
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

      parent reply	other threads:[~2009-10-26 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25 22:23 [PATCH] c/r: coordinator to report correct error on restart failure Oren Laadan
     [not found] ` <1256509416-3897-1-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-26 18:35   ` Serge E. Hallyn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091026183531.GJ23564@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox