[Samba] io_uring cause data corruption

A L mail at lechevalier.se
Sun Apr 26 09:51:42 UTC 2020


Using Samba 4.12.1 with kernel 5.6.7 on Gentoo Linux, I wanted to test 
the new vfs_io_uring module.

* Stand-alone Samba server acting as NAS for home setup.
* /media/usb-backup is a mounted read-only btrfs filesystem.
* Samba share exported as:

===== smb.conf =====
     log level = 1
     workgroup = WORKGROUP
     netbios name = NAS
     server string = Samba Server
     server role = standalone server
     hosts allow = 192.168.0. 127.
     interfaces = lan
     max protocol = SMB3_11

     log file = /var/log/samba/%I.log
     max log size = 10240

     security = user
     passdb backend = tdbsam
     wins support = yes
     dns proxy = yes

     comment = USB Backup - Media files
     path = /media/usb-backup
     writeable = no
     browseable = yes
     read only = yes
     create mask = 0664
     directory mask = 0775
     guest only = Yes
     guest ok = Yes
     force user = nasuser
     force group = nas
     vfs objects = btrfs, io_uring (also tried without the btrfs module)

* Connected from a Windows 10 computer over 1G ethernet.
* Copy data using Windows Explorer and FastCopy(1) from the Samba share 
to a local disk.
* Verify the sha-256 sum on the files.

 From what I can see there is data corruption on many of the files. 
Sha-256 does not match. I copied the same files many times and the data 
corruption occurs within minutes. The total data set is about 800GB.

When I disable io_uring, no data corruptions occur. I verified this with 
multiple TBs of data transferred and no corruptions were detected.

Samba log files contain no errors, nor does dmesg. The Windows client 
detect no error when copying the files.

I'd really like to debug this problem and find the cause. io_uring seems 
to give a massive performance i/o boost.

* net-fs/samba-4.12.1
* sys-devel/gcc-9.3.0
* sys-libs/glibc-2.30-r8
* sys-kernel/linux-headers-5.6
* Linux-kernel-5.6.7-gentoo

Compile info:
* CFLAGS="-O2 -march=native -pipe"
* CPU: "AMD Athlon 3000G with Radeon Vega Graphics"

More information about the samba mailing list