[PATCH] Re: s3: smb2 read sendfile

Stefan (metze) Metzmacher metze at samba.org
Tue Oct 30 04:29:38 MDT 2012


Hi Sebastien,

> So first of all I don't know if the source3 build is still maintained in 
> master and 4.x branch.
> However I needed to use the source3 code in 4.x branch because it does 
> include some features (e.g. largeMTU support) which are not present in the 
> stable 3.6.x release.
> 
> So maybe a first question would be if this is a reasonable choice ? :)

The top level wafbuild and the source3 autoconf build both generate
smbd, nmbd, winbindd binaries which provide the same functionality
on a member server (similar to 3.6.x).

> Second point is (which may be irrelevant if the source3 code is not 
> maintained anymore)I found that the schedule_smb2_sendfile_read never uses 
> the sendfile option in a regular SMB2 test with a windows client.
> 
> There's a bunch of checks before deciding to use sendfile especially this 
> one meant (if I understand correctly) to prevent using sendfile with 
> compound messages:
> 
> smb2req->in.vector_count < (2*SMBD_SMB2_NUM_IOV_PER_REQ)
> 
> which always fail in my case even if my client never sends compound 
> message. 

Yes, that's a bug, thanks for noticing!
It's now tracked under https://bugzilla.samba.org/show_bug.cgi?id=9341
and will be fixed for 4.0.0.

> So guess the correct check would be more like it is in stable branches:
> 
> smb2req->in.vector_count != (SMBD_SMB2_NUM_IOV_PER_REQ + 1)
> 
> I mostly want to be sure I'm not gonna break something with this fix.

While this is a possible fix for now, I'd prefer

smb2req->in.vector_count >= (2*SMBD_SMB2_NUM_IOV_PER_REQ)

As I'd like to remove the magic '1' in future and completely hide the
transport (NBT) header.

Can you verify the attached patch also works for you?

Thanks!

metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-smb2_read-fix-SMBD_SMB2_NUM_IOV_PER_REQ-check-for.patch
Type: text/x-diff
Size: 1012 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121030/cd3865f4/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121030/cd3865f4/attachment.pgp>


More information about the samba-technical mailing list