public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH]i[next] io_uring: remove redundant check on force_nonblock
@ 2020-05-05  9:33 Colin King
  2020-05-05 11:59 ` Pavel Begunkov
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-05-05  9:33 UTC (permalink / raw)
  To: Alexander Viro, Jens Axboe, linux-fsdevel, io-uring
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <[email protected]>

The check on force_nonblock is redundant as this is performed
several statements earlier and also returns with -EAGAIN. Remove
the redundant check.

Addresses-Coverity: ("Logicall dead code")
Signed-off-by: Colin Ian King <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index e5dfbbd2aa34..4b1efb062f7f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2782,7 +2782,7 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock)
 	poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
 	poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
 	ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
-	if (force_nonblock && ret == -EAGAIN)
+	if (ret == -EAGAIN)
 		return -EAGAIN;
 
 	io_put_file(req, in, (sp->flags & SPLICE_F_FD_IN_FIXED));
-- 
2.25.1


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

* Re: [PATCH]i[next] io_uring: remove redundant check on force_nonblock
  2020-05-05  9:33 [PATCH]i[next] io_uring: remove redundant check on force_nonblock Colin King
@ 2020-05-05 11:59 ` Pavel Begunkov
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2020-05-05 11:59 UTC (permalink / raw)
  To: Colin King, Alexander Viro, Jens Axboe, linux-fsdevel, io-uring
  Cc: kernel-janitors, linux-kernel

On 05/05/2020 12:33, Colin King wrote:
> From: Colin Ian King <[email protected]>
> 
> The check on force_nonblock is redundant as this is performed
> several statements earlier and also returns with -EAGAIN. Remove
> the redundant check.

It's kind of scary that such simple transformation is repeatedly done wrongly.
In short, because force_nonblock is always false there, the equivalent
transformation would be to delete it altogether.

Kudos to Jens for his thoroughness. See
https://lore.kernel.org/io-uring/[email protected]/T/#u

> 
> Addresses-Coverity: ("Logicall dead code")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index e5dfbbd2aa34..4b1efb062f7f 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2782,7 +2782,7 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock)
>  	poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
>  	poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
>  	ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
> -	if (force_nonblock && ret == -EAGAIN)
> +	if (ret == -EAGAIN)
>  		return -EAGAIN;
>  
>  	io_put_file(req, in, (sp->flags & SPLICE_F_FD_IN_FIXED));
> 

-- 
Pavel Begunkov

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

end of thread, other threads:[~2020-05-05 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05  9:33 [PATCH]i[next] io_uring: remove redundant check on force_nonblock Colin King
2020-05-05 11:59 ` Pavel Begunkov

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