From: Geliang Tang <tanggeliang@kylinos.cn>
Drop "shutdown" parameter.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/protocol.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 6b3be1d0668d..73359a61ec80 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2090,20 +2090,13 @@ static unsigned int mptcp_inq_hint(const struct sock *sk)
return 0;
}
-static int mptcp_recv_should_stop(struct sock *sk, long timeo, int *shutdown)
+static int mptcp_recv_should_stop(struct sock *sk, long timeo)
{
if (sk->sk_err)
return sock_error(sk);
- if (sk->sk_shutdown & RCV_SHUTDOWN) {
- *shutdown = 1;
- /* race breaker: the shutdown could be after the
- * previous receive queue check
- */
- if (__mptcp_move_skbs(sk))
- *shutdown = 0;
- return 0;
- }
+ if (sk->sk_shutdown & RCV_SHUTDOWN)
+ return -ESHUTDOWN;
if (sk->sk_state == TCP_CLOSE)
return -ENOTCONN;
@@ -2123,7 +2116,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
struct mptcp_sock *msk = mptcp_sk(sk);
struct scm_timestamping_internal tss;
int copied = 0, cmsg_flags = 0;
- int shutdown = -1;
int target;
long timeo;
@@ -2174,11 +2166,18 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
signal_pending(current))
break;
} else {
- copied = mptcp_recv_should_stop(sk, timeo, &shutdown);
- if (copied < 0 || shutdown == 1)
+ copied = mptcp_recv_should_stop(sk, timeo);
+ if (copied == -ESHUTDOWN) {
+ copied = 0;
+ /* race breaker: the shutdown could be after the
+ * previous receive queue check
+ */
+ if (__mptcp_move_skbs(sk))
+ continue;
break;
- if (shutdown == 0)
- continue;
+ } else if (copied < 0) {
+ break;
+ }
}
pr_debug("block timeout %ld\n", timeo);
--
2.48.1