[CRIU] [PATCH 2/5] pipes: do not restore file flags via set_fd_flags()
Stanislav Kinsburskiy
skinsbursky at odin.com
Tue Dec 15 09:37:54 PST 2015
15.12.2015 12:17, Andrew Vagin пишет:
> 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?
I sent some patches upstream:
1) sys_fcntl() allows allow to set O_DIRECT for pipes
2) splice() and vmsplice() become aware of packetized pipes.
Hope, there will be some feedback from Al Viro on these. Because, from
my POW, they are fixing obvious bugs.
If this patches will be accepted, then packetized pipe flags restore can
be done by using sys_fcntl(), and thus the problem you mentioned will be
eliminated.
>> 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