[Samba] io_uring cause data corruption

Jeremy Allison
Fri, 01 May 2020 20:04:11 -0000

On Fri, May 01, 2020 at 09:27:58PM +0200, A L via samba
wrote:
> > Jeremy.
> I did not use a command line, but rather File Explorer
> 1) In File explorer, go to \\SAMBA\share_io_uring\
> 2) Select folder "test2-ro" and choose copy
> 3) Paste to a local drive
>
> The amount of files not working seems to vary, but usually within the 10
> first copied files. You can download a copy of the source test files from
> https://mirrors.tnonline.net/?dir=samba including all checksums.
>
> The file https://mirrors.tnonline.net/samba/test2-ro_no_io_uring.7z
contains
> 1000 copies of the source file
> The file https://mirrors.tnonline.net/samba/test2-ro_with_io_uring.7z
> contains the same files as they ended up after copying to the Windows
> client. Here you can see where the holes (bunch of zeroed data) in the
files
> are created at different offsets.
>
> I hope this helps!

OK, I just did this locally with 100 10MB duplicate files.

Completely correct SHA256 output for every file on both
Windows and Linux after the copy.

Note that these are *separate* files on ext4, not created
with --reflink (ext4 doesn't support it).

The Windows client first tries to do the FSCTL_OFFLOAD_READ
(which our btrfs module does support, but not the default
ext4 module) and then falls back to regular SMB2 async
read, ramping up from 32k initially to 1MB reads.

I'm starting to think the problem is in your btrfs
filesystem, not the Samba uring module.

Before I spend more time on this I'd like you to
create a standard ext4 filesystem, create all the
files with cp *without* using reflink (which ext4
doesn't support) so we know there's no COW shenanigans
and then copy from *that* filesystem to the Windows client
using the iouring module.

I'm not a betting man, but if I was I'd bet the problem
dissapears :-).