[CRIU] [PATCH 2/5] pipes: do not restore file flags via set_fd_flags()
Stanislav Kinsburskiу
skinsbursky at odin.com
Tue Dec 15 03:25:09 PST 2015
15 дек. 2015 г. 12:17 PM пользователь Andrew Vagin <avagin at virtuozzo.com> написал:
>
> On Tue, Dec 15, 2015 at 01:57:50PM +0300, Stanislav Kinsburskiy wrote:
> > It doesn't work for pipes with O_DIRECT. System call sys_pipe2() can be used
> > instead to create pipe with desired flags.
>
> Is it possiable to set O_NONBLOCK only for one end of a pipe? Does this
> code handle this case?
Yes, it's possible.
No, it doesn't handle.
This is a big problem with two piles per pipe...
Probably, kernel have to fixed to be able to set O_DIRECT on pipe via fcntl().
I'll check it.
> >
> > Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> > ---
> > pipes.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/pipes.c b/pipes.c
> > index dfba12d..532ff7e 100644
> > --- a/pipes.c
> > +++ b/pipes.c
> > @@ -273,7 +273,7 @@ static int recv_pipe_fd(struct pipe_info *pi)
> > else
> > fd = tmp;
> > if (fd >= 0) {
> > - if (rst_file_params(fd, pi->pe->fown, pi->pe->flags)) {
> > + if (restore_fown(fd, pi->pe->fown) < 0) {
> > close(fd);
> > return -1;
> > }
> > @@ -316,7 +316,7 @@ static int open_pipe(struct file_desc *d)
> > if (!pi->create)
> > return recv_pipe_fd(pi);
> >
> > - if (pipe(pfd) < 0) {
> > + if (pipe2(pfd, pi->pe->flags & (O_NONBLOCK | O_DIRECT | O_CLOEXEC)) < 0) {
> > pr_perror("Can't create pipe");
> > return -1;
> > }
> > @@ -355,7 +355,7 @@ out:
> > tmp = reopen_pipe(tmp, pi->pe->flags);
> >
> > if (tmp >= 0)
> > - if (rst_file_params(tmp, pi->pe->fown, pi->pe->flags))
> > + if (restore_fown(tmp, pi->pe->fown) < 0)
> > return -1;
> >
> > return tmp;
> >
> > _______________________________________________
> > CRIU mailing list
> > CRIU at openvz.org
> > https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list