[CRIU] [PATCH 2/3] files: split collect_fd on allocate_fd and handle_fd
Andrew Vagin
avagin at virtuozzo.com
Thu Aug 11 13:16:06 PDT 2016
On Wed, Aug 10, 2016 at 03:34:51PM +0300, Pavel Emelyanov wrote:
>
> > @@ -723,14 +732,23 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
> > else
> > collect_gen_fd(new_le, rst_info);
> >
> > - collect_used_fd(new_le, rst_info);
> > -
> > list_add_tail(&new_le->desc_list, &le->desc_list);
> > new_le->desc = fdesc;
> >
> > return 0;
> > }
> >
> > +static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
> > +{
> > + struct fdinfo_list_entry *le;
> > +
> > + le = allocate_fd(pid, e, rst_info);
> > + if (le == NULL)
> > + return -1;
> > +
> > + return handle_fd(le, rst_info);
> > +}
> > +
>
> Presence of this function even after patching makes me think, that after collect
> stage you're still not 100% sure which fds are used which are not.
All used fds is saved in an fdinfo image. In a few cases we need to
allocate an extran fdinfo and it looks like this:
fd = find_unused_fd(&rsti(task)->used, new_fd);
e = dup_fdinfo(ple->fe, fd, flags);
return collect_fd(task->pid.virt, e, rsti(task));
>
> -- Pavel
More information about the CRIU
mailing list