[CRIU] [PATCH 2/5] pipes: do not restore file flags via set_fd_flags()
Andrew Vagin
avagin at virtuozzo.com
Tue Dec 15 03:17:07 PST 2015
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?
>
> 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