[CRIU] Re: [PATCH cr 08/12] pipe: choose who will restore a pipe

Andrew Vagin avagin at parallels.com
Thu Apr 5 08:13:17 EDT 2012


On Thu, Apr 05, 2012 at 04:02:22PM +0400, Pavel Emelyanov wrote:
> On 04/05/2012 03:47 PM, Andrey Vagin wrote:
> > 
> > Add a new function, which will be executed when all fdinfo-s
> > collected.
> > A pipe will be restored by a process with minimal pid and
> > for descriptor with minimal number.
> > 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  cr-restore.c    |    2 +
> >  include/files.h |    1 +
> >  pipes.c         |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 60 insertions(+), 0 deletions(-)
> > 
> 
> > +	while (1) {
> > +		struct fdinfo_list_entry *fle;
> > +		struct pipe_info *pi, *pic, *p;
> > +		int fd, pid;
> > +
> > +		if (list_empty(&pipes))
> > +			break;
> > +
> > +		pi = list_first_entry(&pipes, struct pipe_info, list);
> > +		list_move(&pi->list, &head);

                list_for_each_entry(pic, &pi->pipe_list, pipe_list) {
                        list_move(&pic->list, &head);

Move all pipe entries for this pipe.
> 
> [snip]
> 
> > +	}
> > +
> > +	list_splice(&head, &pipes);
> 
> Why not simple walk over pipes?

Because we will enumerate a pipe entry for a few times.


More information about the CRIU mailing list