[CRIU] [PATCH 2/5] pipes: do not restore file flags via set_fd_flags()

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue Dec 15 02:57:50 PST 2015


It doesn't work for pipes with O_DIRECT. System call sys_pipe2() can be used
instead to create pipe with desired flags.

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;



More information about the CRIU mailing list