commit 48ca7b28c611d07db5bc48a6519385873e058e2c Author: Octavian Purdila Date: Sun Jun 1 22:27:36 2008 +0300 tcp_splice_read: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK This patch changes tcp_splice_read to the behavior implied by man 2 splice: SPLICE_F_NONBLOCK - Do not block on I/O. This makes the splice pipe operations non-blocking, but splice() may nevertheless block because the file descriptors that are spliced to/from may block (unless they have the O_NONBLOCK flag set). Signed-off-by: Octavian Purdila diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 78c66b6..a21d599 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -569,7 +569,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, lock_sock(sk); - timeo = sock_rcvtimeo(sk, flags & SPLICE_F_NONBLOCK); + timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK); while (tss.len) { ret = __tcp_splice_read(sk, &tss); if (ret < 0) @@ -577,10 +577,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, else if (!ret) { if (spliced) break; - if (flags & SPLICE_F_NONBLOCK) { - ret = -EAGAIN; - break; - } if (sock_flag(sk, SOCK_DONE)) break; if (sk->sk_err) {