Message ID | 20190511165727.31599-2-source@stbuehler.de (mailing list archive) |
---|---|
State | RFC |
Headers | show |
Series | [1/5] fs: RWF flags override default IOCB flags from file flags | expand |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 6baa6dc1b13b..65f9917ed8ca 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -784,6 +784,8 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, long timeo; ssize_t spliced; int ret; + bool noblock = (sock->file->f_flags & O_NONBLOCK) || + (flags & SPLICE_F_NONBLOCK); sock_rps_record_flow(sk); /* @@ -796,7 +798,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, lock_sock(sk); - timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK); + timeo = sock_rcvtimeo(sk, noblock); while (tss.len) { ret = __tcp_splice_read(sk, &tss); if (ret < 0)
Now both O_NONBLOCK and SPLICE_F_NONBLOCK will trigger non-blocking behavior. The spice man page is unclear about the exact semantics: First it says splice may still block if SPLICE_F_NONBLOCK is set but O_NONBLOCK isn't. Then it says it might return EAGAIN if one or the other is set (and on my debian system it says EAGAIN can only be returned if SPLICE_F_NONBLOCK was set). Signed-off-by: Stefan Bühler <source@stbuehler.de> --- net/ipv4/tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)