public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: fix short read retries for non-reg files
@ 2021-01-20 23:09 Pavel Begunkov
  2021-01-20 23:50 ` Pavel Begunkov
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-01-20 23:09 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: stable

Sockets and other non-regular files may actually expect short reads to
happen, don't retry reads for them.

Cc: [email protected] # 5.9+
Suggested-by: Jens Axboe <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5f6f1e48954e..544d711b2ef0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3557,6 +3557,9 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
 
 	io_size -= ret;
 copy_iov:
+	if (!(req->flags & REQ_F_ISREG) && ret > 0)
+		goto done;
+
 	ret2 = io_setup_async_rw(req, iovec, inline_vecs, iter, true);
 	if (ret2) {
 		ret = ret2;
-- 
2.24.0


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

* Re: [PATCH 1/1] io_uring: fix short read retries for non-reg files
  2021-01-20 23:09 [PATCH 1/1] io_uring: fix short read retries for non-reg files Pavel Begunkov
@ 2021-01-20 23:50 ` Pavel Begunkov
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2021-01-20 23:50 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: stable

On 20/01/2021 23:09, Pavel Begunkov wrote:
> Sockets and other non-regular files may actually expect short reads to
> happen, don't retry reads for them.

Works well with a quick test, but I think I may have missed a case,
please don't take it yet

> 
> Cc: [email protected] # 5.9+
> Suggested-by: Jens Axboe <[email protected]>
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>  fs/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 5f6f1e48954e..544d711b2ef0 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -3557,6 +3557,9 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
>  
>  	io_size -= ret;
>  copy_iov:
> +	if (!(req->flags & REQ_F_ISREG) && ret > 0)
> +		goto done;
> +
>  	ret2 = io_setup_async_rw(req, iovec, inline_vecs, iter, true);
>  	if (ret2) {
>  		ret = ret2;
> 

-- 
Pavel Begunkov

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

end of thread, other threads:[~2021-01-21  3:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-20 23:09 [PATCH 1/1] io_uring: fix short read retries for non-reg files Pavel Begunkov
2021-01-20 23:50 ` Pavel Begunkov

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