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>
This commit is contained in:
committed by
David S. Miller
parent
129fa44785
commit
4f7d54f59b
@@ -580,10 +580,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
|
|||||||
else if (!ret) {
|
else if (!ret) {
|
||||||
if (spliced)
|
if (spliced)
|
||||||
break;
|
break;
|
||||||
if (flags & SPLICE_F_NONBLOCK) {
|
|
||||||
ret = -EAGAIN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sock_flag(sk, SOCK_DONE))
|
if (sock_flag(sk, SOCK_DONE))
|
||||||
break;
|
break;
|
||||||
if (sk->sk_err) {
|
if (sk->sk_err) {
|
||||||
@@ -601,6 +597,10 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
|
|||||||
ret = -ENOTCONN;
|
ret = -ENOTCONN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (flags & SPLICE_F_NONBLOCK) {
|
||||||
|
ret = -EAGAIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!timeo) {
|
if (!timeo) {
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user