[CRIU] [PATCH] page-pipe: Don't increase the page_pipe::nr_pipes if we reuse pipes

Andrew Vagin avagin at parallels.com
Tue May 6 11:38:49 PDT 2014


On Tue, May 06, 2014 at 06:57:01PM +0400, Cyrill Gorcunov wrote:
> The page-pipe buffers may be reused once queued pages are
> dumped, but we happen to increase page_pipe::nr_pipes
> all the timer, regardless the fact where page buffer
> came from.
> 
> In worst scenario this may lead to incorrect -EAGAIN returned
> from page_pipe_grow forcing calling code to create new
> pipes. This is not critical but should be fixed.
> 
> In other words page_pipe::nr_pipes must track _really_
> created pipes.

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

> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  page-pipe.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/page-pipe.c b/page-pipe.c
> index e685ef9fd22f..1aa51313f407 100644
> --- a/page-pipe.c
> +++ b/page-pipe.c
> @@ -34,6 +34,7 @@ static int page_pipe_grow(struct page_pipe *pp)
>  	}
>  
>  	ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
> +	pp->nr_pipes++;
>  
>  	list_add_tail(&ppb->l, &pp->bufs);
>  out:
> @@ -41,8 +42,6 @@ out:
>  	ppb->nr_segs = 0;
>  	ppb->iov = &pp->iovs[pp->free_iov];
>  
> -	pp->nr_pipes++;
> -
>  	return 0;
>  }
>  
> -- 
> 1.8.3.1
> 


More information about the CRIU mailing list