[CRIU] [PATCH] restore: die properly if restore_one_task fails

Andrew Vagin avagin at parallels.com
Fri Aug 29 08:06:51 PDT 2014


On Fri, Aug 29, 2014 at 08:58:39AM -0500, Tycho Andersen wrote:
> On Fri, Aug 29, 2014 at 04:46:00PM +0400, Pavel Emelyanov wrote:
> > On 08/28/2014 10:14 PM, Tycho Andersen wrote:
> > > This is really just the last bit of c32046c9; if restore_one_task() fails, we
> > > need to do the same futex wakeup we do everywhere else in this function.
> > > 
> > > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > > ---
> > >  cr-restore.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/cr-restore.c b/cr-restore.c
> > > index cefa78e..ec4b648 100644
> > > --- a/cr-restore.c
> > > +++ b/cr-restore.c
> > > @@ -1467,7 +1467,10 @@ static int restore_task_with_children(void *_arg)
> > >  	if (current->parent == NULL && fini_mnt_ns())
> > >  		goto err_fini_mnt;
> > >  
> > > -	return restore_one_task(current->pid.virt, ca->core);
> > > +	if (restore_one_task(current->pid.virt, ca->core))
> > > +		goto err_fini_mnt;
> > 
> > The fini_mnt, that will be called on err_fini_mnt laber, is called one 
> > function above. Shouldn't this be "goto err" instead?
> 
> Yes. The one above it should probably not be err_fini_mnt either for
> that matter, since that's what just failed.

I missed this too. Thanks.

Acked-by: Andrew Vagin <avagin at parallels.com>

> 
> Tycho
> 
> 
> 
> 
> This is really just the last bit of c32046c9; if restore_one_task() fails, we
> need to do the same futex wakeup we do everywhere else in this function.
> 
> v2: use err instead of err_fini_mnt after mount has been finalized normally
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> Acked-by: Acked-by: Andrew Vagin <avagin at parallels.com>
> ---
>  cr-restore.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index cefa78e..2735d0d 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -1465,9 +1465,12 @@ static int restore_task_with_children(void *_arg)
>  		goto err_fini_mnt;
>  
>  	if (current->parent == NULL && fini_mnt_ns())
> -		goto err_fini_mnt;
> +		goto err;
>  
> -	return restore_one_task(current->pid.virt, ca->core);
> +	if (restore_one_task(current->pid.virt, ca->core))
> +		goto err;
> +
> +	return 0;
>  
>  err_fini_mnt:
>  	if (current->parent == NULL)
> -- 
> 1.9.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list