Re: linux-5.7-rc4/fs/io_uring.c:2786: bad if test ?

From: Jens Axboe
Date: Mon May 04 2020 - 09:48:01 EST


On 5/4/20 2:12 AM, David Binderman wrote:
> Hello there,
>
> linux-5.7-rc4/fs/io_uring.c:2786:6: warning: Identical condition 'force_nonblock', second condition is always false [identicalConditionAfterEarlyExit]
>
> Source code is
>
> if (force_nonblock)
> return -EAGAIN;
>
> 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)
> return -EAGAIN;
>
> So the second return can never execute. Suggest code rework.

Looks like that's a leftover of the "only punt sometimes" code. That
second one is indeed dead now, Pavel is re-working the async punt
for 5.8 anyway so I don't think it's worth touching at this point.

--
Jens Axboe