[CRIU] [PATCH 2/3] tcp: check repair before fastopen in tcp_sendmsg
Andrey Vagin
avagin at openvz.org
Tue Mar 4 21:18:11 PST 2014
First of all it is logical.
And I found that sk_stream_wait_connect can be called if a socket
isn't in the TCP_ESTABLISHED state. In this case we get -EPIPE.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
net/ipv4/tcp.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 819fa37..9a23905 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1082,6 +1082,20 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
lock_sock(sk);
flags = msg->msg_flags;
+
+ if (unlikely(tp->repair)) {
+ if (tp->repair_queue == TCP_RECV_QUEUE) {
+ copied = tcp_send_rcvq(sk, msg, size);
+ goto out;
+ }
+
+ err = -EINVAL;
+ if (tp->repair_queue == TCP_NO_QUEUE)
+ goto out_err;
+
+ /* 'common' sending to sendq */
+ }
+
if (flags & MSG_FASTOPEN) {
err = tcp_sendmsg_fastopen(sk, msg, &copied_syn);
if (err == -EINPROGRESS && copied_syn > 0)
@@ -1103,19 +1117,6 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
goto do_error;
}
- if (unlikely(tp->repair)) {
- if (tp->repair_queue == TCP_RECV_QUEUE) {
- copied = tcp_send_rcvq(sk, msg, size);
- goto out;
- }
-
- err = -EINVAL;
- if (tp->repair_queue == TCP_NO_QUEUE)
- goto out_err;
-
- /* 'common' sending to sendq */
- }
-
/* This should be in poll */
clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
--
1.8.5.3
More information about the CRIU
mailing list