[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220415005015.525191-1-avagin@gmail.com>
Date: Thu, 14 Apr 2022 17:50:15 -0700
From: Andrei Vagin <avagin@...il.com>
To: linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org, Andrei Vagin <avagin@...il.com>,
stable@...nel.org
Subject: [PATCH] fs: sendfile handles O_NONBLOCK of out_fd
sendfile has to return EAGAIN if out_fd is nonblocking and the write
into it would block.
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: stable@...nel.org
Fixes: b964bf53e540 ("teach sendfile(2) to handle send-to-pipe directly")
Signed-off-by: Andrei Vagin <avagin@...il.com>
---
fs/read_write.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/read_write.c b/fs/read_write.c
index e643aec2b0ef..ee59419cbf0f 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1247,6 +1247,9 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
count, fl);
file_end_write(out.file);
} else {
+ if (out.file->f_flags & O_NONBLOCK)
+ fl |= SPLICE_F_NONBLOCK;
+
retval = splice_file_to_pipe(in.file, opipe, &pos, count, fl);
}
--
2.35.1
Powered by blists - more mailing lists