Re: Data Corruption bug with Samba's vfs_iouring and Linux 5.6.7/5.7rc3

Pavel Begunkov
2020-05-06T15:44:05Z

On 06/05/2020 18:20, Stefan Metzmacher wrote:
> Am 06.05.20 um 14:55 schrieb Pavel Begunkov:
>> On 05/05/2020 23:19, Stefan Metzmacher wrote:
>> AFAIK, it can. io_uring first tries to submit a request with IOCB_NOWAIT,
>> in short for performance reasons. And it have been doing so from the beginning
>> or so. The same is true for writes.
>
> See the other mails in the thread. The test I wrote shows the

Cool you resolved the issue!

> implicit IOCB_NOWAIT was not exposed to the caller in (at least in 5.3
> and 5.4).
>

# git show remotes/origin/for-5.3/io_uring:fs/io_uring grep "kiocb->ki_flags |=
IOCB_NOWAIT" -A 5 -B 5

if (force_nonblock)
kiocb->ki_flags |= IOCB_NOWAIT;

And it have been there since 5.2 or even earlier. I don't know, your results
could be because of different policy in block layer, something unexpected in
io_uring, etc., but it's how it was intended to be.

> I think the typical user don't want it to be exposed!
> I'm not sure for blocking reads on a socket, but for files
> below EOF it's really not what's expected.

Hard to say, but even read(2) without any NONBLOCK doesn't guarantee that.
Hopefully, BPF will help us with that in the future.

>
> If that behavior is desired RWF_NOWAIT can be used explicitly.
>
> metze
>

--
Pavel Begunkov