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

Stefan Metzmacher metze at samba.org
Tue May 5 20:19:21 UTC 2020


Hi Jens,

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

Thanks for taking a look!

> 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.

I guess I don't expect short reads for files unless the client asked
for a read beyond EOF. Does IORING_OP_READV may return short reads
similar to preadv2 with RWF_NOWAIT? And if so, did this got changed
since 5.3?

By default Samba uses pread()/pwrite() from within a helper thread
and I modeled the io_uring module with the same expecations that
we wouldn't get a short read if only part of the requested buffer (can
be up to 8MB) is returned because only some of it is already in the
buffer cache.

I'll try the ubuntu 5.4 kernel tomorrow.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20200505/6084dcb6/signature.sig>


More information about the samba-technical mailing list