From: Geliang Tang <tanggeliang@kylinos.cn>
Update the parameter of mptcp_recv_should_stop.
Use mptcp_recv_should_stop at the end of the main loop too.
Rename to tcp_recv_should_stop.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/protocol.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index caeb48823058..bcae97b48b4b 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4037,10 +4037,9 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,
.flags = flags,
};
struct sock *sk = sock->sk;
- int shutdown = -1;
ssize_t spliced;
+ int ret, err;
long timeo;
- int ret;
/*
* We can't seek on a socket input
@@ -4063,11 +4062,17 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,
break;
if (sock_flag(sk, SOCK_DONE))
break;
- ret = mptcp_recv_should_stop(sk, timeo, &shutdown);
- if (ret < 0 || shutdown == 1)
+ err = tcp_recv_should_stop(sk, timeo);
+ if (err < 0) {
+ if (err == -ESHUTDOWN) {
+ if (__mptcp_move_skbs(sk))
+ continue;
+ break;
+ }
+ if (err != -ENETDOWN)
+ ret = err;
break;
- if (shutdown == 0)
- continue;
+ }
/* if __mptcp_splice_read() got nothing while we have
* an skb in receive queue, we do not want to loop.
* This might happen with URG data.
@@ -4087,9 +4092,7 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,
release_sock(sk);
lock_sock(sk);
- if (sk->sk_err || sk->sk_state == TCP_CLOSE ||
- (sk->sk_shutdown & RCV_SHUTDOWN) ||
- signal_pending(current))
+ if (tcp_recv_should_stop(sk, timeo))
break;
}
--
2.48.1