提交 ddb61a57 编写于 作者: J Jens Axboe 提交者: David S. Miller

[TCP] tcp_read_sock: Allow recv_actor() return return negative error value.

tcp_read_sock() currently assumes that the recv_actor() only returns
number of bytes copied. For network splice receive, we may have to
return an error in some cases. So allow the actor to return a negative
error value.
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4b2a8fb3
...@@ -1064,7 +1064,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, ...@@ -1064,7 +1064,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
break; break;
} }
used = recv_actor(desc, skb, offset, len); used = recv_actor(desc, skb, offset, len);
if (used <= len) { if (used < 0) {
if (!copied)
copied = used;
break;
} else if (used <= len) {
seq += used; seq += used;
copied += used; copied += used;
offset += used; offset += used;
...@@ -1086,7 +1090,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, ...@@ -1086,7 +1090,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
tcp_rcv_space_adjust(sk); tcp_rcv_space_adjust(sk);
/* Clean up data we have read: This will do ACK frames. */ /* Clean up data we have read: This will do ACK frames. */
if (copied) if (copied > 0)
tcp_cleanup_rbuf(sk, copied); tcp_cleanup_rbuf(sk, copied);
return copied; return copied;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册