public inbox for [email protected]
 help / color / mirror / Atom feed
* [RESEND for-5.20] io_uring/net: fix overexcessive retries
@ 2022-08-26 16:15 Pavel Begunkov
  2022-08-26 18:42 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2022-08-26 16:15 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

Length 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 <[email protected]>
---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 0af8a02df580..7a5468cc905e 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 -= copied;
 	from->iov_offset = bi.bi_bvec_done;
 
 	skb->data_len += copied;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND for-5.20] io_uring/net: fix overexcessive retries
  2022-08-26 16:15 [RESEND for-5.20] io_uring/net: fix overexcessive retries Pavel Begunkov
@ 2022-08-26 18:42 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-08-26 18:42 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On Fri, 26 Aug 2022 17:15:47 +0100, Pavel Begunkov wrote:
> Length 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.
> 
> 
> [...]

Applied, thanks!

[1/1] io_uring/net: fix overexcessive retries
      (no commit info)

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-26 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-26 16:15 [RESEND for-5.20] io_uring/net: fix overexcessive retries Pavel Begunkov
2022-08-26 18:42 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox