* [PATCH][next] io_uring: Remove logically dead code in io_splice
@ 2020-05-04 15:19 Gustavo A. R. Silva
2020-05-04 15:22 ` Pavel Begunkov
2020-05-04 15:25 ` Jens Axboe
0 siblings, 2 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2020-05-04 15:19 UTC (permalink / raw)
To: Jens Axboe, Alexander Viro, Pavel Begunkov
Cc: io-uring, linux-fsdevel, linux-kernel, Gustavo A. R. Silva
In case force_nonblock happens to be true, the function returns
at:
2779 if (force_nonblock)
2780 return -EAGAIN;
before reaching this line of code. So, the null check on force_nonblock
at 2785, is never actually being executed.
Addresses-Coverity-ID: 1492838 ("Logically dead code")
Fixes: 2fb3e82284fc ("io_uring: punt splice async because of inode mutex")
Signed-off-by: Gustavo A. R. Silva <[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.26.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][next] io_uring: Remove logically dead code in io_splice
2020-05-04 15:19 [PATCH][next] io_uring: Remove logically dead code in io_splice Gustavo A. R. Silva
@ 2020-05-04 15:22 ` Pavel Begunkov
2020-05-04 15:25 ` Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2020-05-04 15:22 UTC (permalink / raw)
To: Gustavo A. R. Silva, Jens Axboe, Alexander Viro
Cc: io-uring, linux-fsdevel, linux-kernel
On 04/05/2020 18:19, Gustavo A. R. Silva wrote:
> In case force_nonblock happens to be true, the function returns
> at:
>
> 2779 if (force_nonblock)
> 2780 return -EAGAIN;
>
> before reaching this line of code. So, the null check on force_nonblock
> at 2785, is never actually being executed.
>
> Addresses-Coverity-ID: 1492838 ("Logically dead code")
> Fixes: 2fb3e82284fc ("io_uring: punt splice async because of inode mutex")
It's not a bug, so 'Fixes' tag is IMHO misleading. Anyway,
Acked-by: Pavel Begunkov <[email protected]>
> Signed-off-by: Gustavo A. R. Silva <[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] 5+ messages in thread
* Re: [PATCH][next] io_uring: Remove logically dead code in io_splice
2020-05-04 15:19 [PATCH][next] io_uring: Remove logically dead code in io_splice Gustavo A. R. Silva
2020-05-04 15:22 ` Pavel Begunkov
@ 2020-05-04 15:25 ` Jens Axboe
2020-05-04 15:52 ` Pavel Begunkov
2020-05-04 15:58 ` Gustavo A. R. Silva
1 sibling, 2 replies; 5+ messages in thread
From: Jens Axboe @ 2020-05-04 15:25 UTC (permalink / raw)
To: Gustavo A. R. Silva, Alexander Viro, Pavel Begunkov
Cc: io-uring, linux-fsdevel, linux-kernel
On 5/4/20 9:19 AM, Gustavo A. R. Silva wrote:
> In case force_nonblock happens to be true, the function returns
> at:
>
> 2779 if (force_nonblock)
> 2780 return -EAGAIN;
>
> before reaching this line of code. So, the null check on force_nonblock
> at 2785, is never actually being executed.
>
> Addresses-Coverity-ID: 1492838 ("Logically dead code")
> Fixes: 2fb3e82284fc ("io_uring: punt splice async because of inode mutex")
> Signed-off-by: Gustavo A. R. Silva <[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;
This isn't right, it should just remove the two lines completely. But
also see:
https://lore.kernel.org/io-uring/[email protected]/T/#u
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][next] io_uring: Remove logically dead code in io_splice
2020-05-04 15:25 ` Jens Axboe
@ 2020-05-04 15:52 ` Pavel Begunkov
2020-05-04 15:58 ` Gustavo A. R. Silva
1 sibling, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2020-05-04 15:52 UTC (permalink / raw)
To: Jens Axboe, Gustavo A. R. Silva, Alexander Viro
Cc: io-uring, linux-fsdevel, linux-kernel
On 04/05/2020 18:25, Jens Axboe wrote:
> On 5/4/20 9:19 AM, Gustavo A. R. Silva wrote:
>> In case force_nonblock happens to be true, the function returns
>> at:
>>
>> 2779 if (force_nonblock)
>> 2780 return -EAGAIN;
>>
>> before reaching this line of code. So, the null check on force_nonblock
>> at 2785, is never actually being executed.
>>
>> Addresses-Coverity-ID: 1492838 ("Logically dead code")
>> Fixes: 2fb3e82284fc ("io_uring: punt splice async because of inode mutex")
>> Signed-off-by: Gustavo A. R. Silva <[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;
>
> This isn't right, it should just remove the two lines completely. But
> also see:
Oh, right, it will ignore O_NONBLOCK and be resubmitted, as going through
io_wq_submit_work(). I need to be more attentive.
>
> https://lore.kernel.org/io-uring/[email protected]/T/#u
>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][next] io_uring: Remove logically dead code in io_splice
2020-05-04 15:25 ` Jens Axboe
2020-05-04 15:52 ` Pavel Begunkov
@ 2020-05-04 15:58 ` Gustavo A. R. Silva
1 sibling, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2020-05-04 15:58 UTC (permalink / raw)
To: Jens Axboe, Alexander Viro, Pavel Begunkov
Cc: io-uring, linux-fsdevel, linux-kernel
On 5/4/20 10:25, Jens Axboe wrote:
>> 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;
>
> This isn't right, it should just remove the two lines completely. But
> also see:
>
> https://lore.kernel.org/io-uring/[email protected]/T/#u
>
Oh, I see now. Thanks for the feedback.
--
Gustavo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-04 16:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-04 15:19 [PATCH][next] io_uring: Remove logically dead code in io_splice Gustavo A. R. Silva
2020-05-04 15:22 ` Pavel Begunkov
2020-05-04 15:25 ` Jens Axboe
2020-05-04 15:52 ` Pavel Begunkov
2020-05-04 15:58 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox