aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@marvell.com>2009-01-05 00:00:12 -0800
committerDavid S. Miller <davem@davemloft.net>2009-01-05 00:00:12 -0800
commit4f7d54f59bc470f0aaa932f747a95232d7ebf8b1 (patch)
tree9d391a6c4d9fdb1c8534127702b5543b0b5ab089 /net
parent129fa44785a399248ae2466b6cb5c655e96668f7 (diff)
downloadmrst-s0i3-test-4f7d54f59bc470f0aaa932f747a95232d7ebf8b1.tar.gz
mrst-s0i3-test-4f7d54f59bc470f0aaa932f747a95232d7ebf8b1.tar.xz
mrst-s0i3-test-4f7d54f59bc470f0aaa932f747a95232d7ebf8b1.zip
tcp: don't mask EOF and socket errors on nonblocking splice receive
Currently, setting SPLICE_F_NONBLOCK on splice from a TCP socket results in masking of EOF (RDHUP) and error conditions on the socket by an -EAGAIN return. Move the NONBLOCK check in tcp_splice_read() to be after the EOF and error checks to fix this. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4d655e94541..bce1b068f2a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -580,10 +580,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) {
@@ -601,6 +597,10 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
ret = -ENOTCONN;
break;
}
+ if (flags & SPLICE_F_NONBLOCK) {
+ ret = -EAGAIN;
+ break;
+ }
if (!timeo) {
ret = -EAGAIN;
break;