readx and CAP_LARGE_READX

James Peach jpeach at samba.org
Thu Dec 7 23:34:49 GMT 2006


On Dec 7, 2006, at 3:08 PM, tridge at samba.org wrote:

> James,
>
>> Samba3, on the other hand, implements the readX semantics describes  
>> in
>> the SNIA spec.
>
> yes, I can believe that :-)
>
> The problem is, if you just follow that spec, and write a tool that
> relies on that behaviour, then you may end up finding that the tool
> doesn't work with any windows server. That's what has happened with
> cifsdd.

cifsdd is stupid by design. I wrote is because I wanted a tool to give  
me precise control over how I/O is done on the wire. If windows  
doesn't implement the SNIA readX behaviour, then I am perfectly happy  
for cifsdd to not work.

However, Samba3 does implement the SNIA readX behaviour (and there are  
non-Windows clients in the wild that take advantage of this). I'm  
arguing that the Samba4 libcli should let me take advantage of the  
Samba3 implementation if it is there.

> If Samba had a dominant position in the market this would be fine, but
> unfortunately we don't :(
>
> There is another complication to this as well. If the client and
> server negotiate SMB signing, and the server is w2k3, and you write
> more than the negotiated buffer size (usually around 4k), then w2k3
> screws up the signing and gives you an error on writex, even though
> CAP_LARGE_WRITEX is negotiated.

For cifsdd I try to ask libcli to negotiate a buffer size large enough  
for the size of the I/Os I want to do. IIRC I proceed to ignore the  
buffer size that was actually negotiated, so it sounds like this  
"behaviour" could bite me.

> So I think you are going to have to modify cifsdd to break up reads
> and writes so that they work with windows servers. That means:
>
>  - if CAP_LARGE_READX is set, then readx no more than 64k
>  - if CAP_LARGE_READX is not set, then readx no more than negotiated
>    buffer size
>  - if signing is negotiated or if CAP_LARGE_WRITEX is not set, then
>    write no more than negotiated buffer size
>  - if signing is not negotiated and CAP_LARGE_WRITEX is set, then
>    write a maximum of 64k

Maybe I should to add an argument to cifsdd to relax it's I/O  
behaviour. Something that means "try to do what I told you, but play  
it safe so things will actually work".

--
James Peach | jpeach at samba.org



More information about the samba-technical mailing list