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

Jens Axboe
2020-05-05T16:53:37Z

On 5/5/20 9:44 AM, Jens Axboe wrote:
> On 5/5/20 8:41 AM, Jens Axboe wrote:
>> On 5/5/20 4:04 AM, Stefan Metzmacher wrote:
>>> Hi Jens,
>>>
>>> we currently have a bug report [1][2] regarding a data corruption with
>>> Samba's vfs_io_uring.c [3].
>>>
>>> Is there're a know problem in newer kernels? It seems the 5.3 Kernel
>>> doesn't have the problem (at least Jeremy wasn't able to reproduce it
>>> on the Ubuntu 5.3 kernel).
>>>
>>> Do you have any hints how to track that down?
>>
>> I'll take a look at this! Any chance Jeremy can try 5.4 and 5.5 as well,
>> just to see where we're at, roughly? That might be very helpful.
>
> Trying to setup samba in a vm here to attempt to reproduce. I'm a major
> samba noob, running with the smb.conf from the reporters email, I get:
>
> [2020/05/05 15:43:07.126674, 0] ../../source4/smbd/server.c:629(binary_smbd_main)
> samba version 4.12.2 started.
> Copyright Andrew Tridgell and the Samba Team 1992-2020
> [2020/05/05 15:43:07.152828, 0] ../../source4/smbd/server.c:826(binary_smbd_main)
> At this time the 'samba' binary should only be used for either:
> 'server role = active directory domain controller' or to access the ntvfs file server with 'server services = +smb' or the rpc proxy with 'dcerpc endpoint servers = remote'
> You should start smbd/nmbd/winbindd instead for domain member and standalone file server tasks
> [2020/05/05 15:43:07.152937, 0] ../../lib/util/become_daemon.c:121(exit_daemon)
> exit_daemon: daemon failed to start: Samba detected misconfigured 'server role' and exited. Check logs for details, error code 22
>
> Clue bat appreciated.

Got it working, but apparently the arch samba doesn't come with io_uring...
One question, though, from looking at the source:

static ssize_t vfs_io_uring_pread_recv(struct tevent_req *req,
struct vfs_aio_state *vfs_aio_state)
{
[...]
if (state->ur.cqe.res < 0) {
vfs_aio_state->error = -state->ur.cqe.res;
ret = -1;
} else {
vfs_aio_state->error = 0;
ret = state->ur.cqe.res;
}

tevent_req_received(req);
[...]

I'm assuming this is dealing with short reads?

I'll try and see if I can get an arch binary build that has the
vfs_io_uring module and reproduce.

--
Jens Axboe