[CRIU] Re: [PATCH 2/5] fifo: Add checkpoint restore for fifos
Cyrill Gorcunov
gorcunov at openvz.org
Tue Jun 26 05:51:07 EDT 2012
On Tue, Jun 26, 2012 at 01:37:36PM +0400, Pavel Emelyanov wrote:
>
> The patch got corrupted. Use attach.
yeah, sorry
> > + if (dump_one_reg_file(lfd, id, p))
> > + return -1;
>
> Good. But the dump_ghost_file on unlinked fifo will try to copy out
> its contents. Not good.
ok, will update (nothing critical though since the file is empty
and copy-files handle such case without problems).
> > + if (rfi->remap_path)
> > + unlink(rfi->path);
> > +
> > + if (restore_fown(new_fifo, &rfi->rfe.fown) < 0) {
> > + pr_perror("Can't restore owner on fifo %#08x",
> > + info->fe.id);
> > + goto err_close_new;
> > + }
>
> Most of the above is done by the open_fe_fd fn. Try to merge.
ok
> > +static int handle_fifo_data(void)
> > +{
> > + int img, ret;
> > +
> > + img = open_image_ro(CR_FD_FIFO_DATA);
> > + if (img < 0)
> > + return -1;
> > +
> > + while (1) {
> > + struct pipe_data_entry pde;
> > + struct fifo_info *info;
> > +
> > + ret = read_img_eof(img, &pde);
> > + if (ret <= 0)
> > + break;
> > +
> > + list_for_each_entry(info, &fifo_head, list) {
> > + if (info->fe.pipe_id != pde.pipe_id)
> > + continue;
> > +
> > + info->off = lseek(img, 0, SEEK_CUR) + pde.off;
> > + info->bytes = pde.bytes;
> > +
> > + lseek(img, pde.bytes + pde.off, SEEK_CUR);
> > + break;
> > + }
> > + }
>
> This looks like handle_pipes_data.
well, i'll need to use callbacks probably since container structure
(pipe_info/fifo_info) are different. will try.
Cyrill
More information about the CRIU
mailing list