[CRIU] [PATCH] pipes: Restore pipe size via userns call
Cyrill Gorcunov
gorcunov at gmail.com
Mon Mar 13 12:16:16 PDT 2017
On Mon, Mar 13, 2017 at 11:44:39AM -0700, Andrei Vagin wrote:
...
> > int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash)
> > {
> > int ret;
> > @@ -201,13 +221,11 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
> > out:
> > ret = 0;
> > if (pd->pde->has_size) {
> > - pr_info("Restoring size %#x for %#x\n",
> > - pd->pde->size, pd->pde->pipe_id);
> > - ret = fcntl(pfd, F_SETPIPE_SZ, pd->pde->size);
> > - if (ret < 0)
> > - pr_perror("Can't restore pipe size");
> > - else
> > - ret = 0;
> > + pipe_set_size_arg_t args = {
> > + .pipe_id = pd->pde->pipe_id,
> > + .size = (size_t)pd->pde->size,
> > + };
> > + ret = userns_call(pipe_set_size, UNS_ASYNC, &args, sizeof(args), pfd);
>
> UNS_ASYNC is used to improve perfomance, isn't it? If it is, I would
> suggest to try to set a pipe size here and make userns_call only if it is failed
> with EPERM. In this case we can do this synchroniously, because the
> number of these calls probably will be small. And you will be able to
> apply Pavel's comment.
Which would bloat code size :/ Drop it. Hopefully I'll code with
some better idea.
More information about the CRIU
mailing list