diff mbox series

[for-5.20] io_uring/net: fix overexcessive retries

Message ID 7ae9790cdf2f30cd381efda5b159ef95c88cf8eb.1661529830.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [for-5.20] io_uring/net: fix overexcessive retries | expand

Commit Message

Pavel Begunkov Aug. 26, 2022, 4:04 p.m. UTC
Lenght parameter of io_sg_from_iter() can be smaller than the iterator's
size, as it's with TCP, so when we set from->count at the end of the
function we truncate the iterator forcing TCP to return preliminary with
a short send. It affects zerocopy sends with large payload sizes and
leads to retries and possible request failures.

Fixes: 3ff1a0d395c00 ("io_uring: enable managed frags with register buffers")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Begunkov Aug. 26, 2022, 4:05 p.m. UTC | #1
On 8/26/22 17:04, Pavel Begunkov wrote:
> Lenght parameter of io_sg_from_iter() can be smaller than the iterator's
> size, as it's with TCP, so when we set from->count at the end of the
> function we truncate the iterator forcing TCP to return preliminary with
> a short send. It affects zerocopy sends with large payload sizes and
> leads to retries and possible request failures.

sent a wrong one, please ignore
diff mbox series

Patch

diff --git a/io_uring/net.c b/io_uring/net.c
index 0af8a02df580..629a02a148d4 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -956,7 +956,7 @@  static int io_sg_from_iter(struct sock *sk, struct sk_buff *skb,
 	shinfo->nr_frags = frag;
 	from->bvec += bi.bi_idx;
 	from->nr_segs -= bi.bi_idx;
-	from->count = bi.bi_size;
+	from->count -= bi.bi_size;
 	from->iov_offset = bi.bi_bvec_done;
 
 	skb->data_len += copied;