What is the purpose of CAP_LARGE_READX?

Andrew Bartlett abartlet at samba.org
Mon Jan 21 00:51:40 MST 2013


On Thu, 2013-01-17 at 15:01 -0800, George K Colley wrote:
> On Jan 17, 2013, at 2:24 PM, Christopher R. Hertel <crh at ubiqx.mn.org> wrote:
> 
> > On 01/17/2013 04:15 PM, Jeremy Allison wrote:
> >> On Fri, Jan 18, 2013 at 09:10:33AM +1100, Andrew Bartlett wrote:
> >>> On Thu, 2013-01-17 at 13:54 -0800, Jeremy Allison wrote:
> >>>> On Fri, Jan 18, 2013 at 08:44:42AM +1100, Andrew Bartlett wrote:
> >>>>> I'm chasing a bug where a MacOSX client asks for 64k of data, we ignore
> >>>>> the high bits, and return 0 bytes.  The client then writes a 64k zero
> >>>>> page locally. 
> >>>>> 
> >>>>> The formal bug report will follow once I clear the details with the
> >>>>> reporter, but it raised in my head some 'meta' questions.
> >>>>> 
> >>>>> What is the purpose of CAP_LARGE_READX?  The Samba smbd file server only
> >>>>> mentions it to claim support for it in negprot, but does not use it in
> >>>>> reply.c since
> >>>>> https://git.samba.org/?p=samba.git;a=commitdiff;h=f8c26c16b82989e002b839fc9eba6386fc036f6a
> >>>>> 
> >>>>> I would say 'so, we should not advertise it', but the trace I've been
> >>>>> given of Win2008R2 also claims the same flag, but that patch claims it
> >>>>> also isn't supported.
> >>>>> 
> >>>>> If the only way to do large reads and writes with SMB1 is via the unix
> >>>>> extensions, what is the purpose of the capability flag?
> >>>> 
> >>>> Was created to allow implementations to do unix extensions without
> >>>> having to allow large readX or large writeX calls (there's also a
> >>>> CAP_LARGE_WRITEX). As we're the only server who ever implemented
> >>>> the unix extensions they appear synonomous, but they're not.
> >>> 
> >>> I guess what I'm puzzled at is windows advertising it, but not honouring
> >>> it, or getting a closer idea what's really going on.
> >> 
> >> Oh, ok - if Windows is advertizing it them I'm completely confused,
> >> and I'm not remembering the CAP flags correctly. Sorry, ignore my
> >> previous comment :-).
> > 
> > It is in the Windows code, but I will need to re-read portions of MS-CIFS
> > and MS-SMB to jog my memory.  As I recall (vaguely), CAP_LARGE_READX and
> > CAP_LARGE_WRITEX were defined at the same time, but one of them was not
> > implemented until much later.
> > 
> Correct NT4 only supported SMB_CAP_LARGE_READX, WinXP and above support both

What I'm confused by, is why this seems to have gone out of use, after
being in use?  Our raw.read test shows that Windows ignores this, and
now Samba does to.

Getting back to the issue at hand, what seems to be happening in this
bug https://bugzilla.samba.org/show_bug.cgi?id=9572 is that the Mac
client expects Samba servers to honour this flag, but not windows
servers.  I think is is because the mac has seen both the Unix
capability and called QueryFSInfo to see the Unix large read bit. 

Is it correct to say that the Mac client never calls the SetFSInfo side
of the unix extension negotiation?  (That is, it expects the behaviours
found in the QueryFSInfo to be available, without the set?)

Since
http://git.samba.org/?p=samba.git;a=commitdiff;h=f8c26c16b82989e002b839fc9eba6386fc036f6a
Samba is coded to expect that clients will positively negotiate this
capability, which is why, I think we get the data corruption here. 

source3/smbd/reply.c:3896
	if ((sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_LARGE_READ_CAP)
||
	    (get_remote_arch() == RA_SAMBA)) {

(this references where we store the information passed to Samba is by
the SetFSInfo unix extensions level)

The simple, and at this point I think only reasonable fix would seem to
be to revert this change, and to instead gate it us having indicated
unix extensions to the client.  I don't want the QueryFSInfo call to
have side-effects, and we honoured this large read flag for quite some
time without side-effects.  Strict matching of windows can then be
obtained by turning off unix extensions.

We got here because of the long-standing behaviour in the past not
needing a SetFSInfo in Samba, and the only reference to doing a
SetFSInfo being one line in the 'specification' wiki page:
https://wiki.samba.org/index.php/UNIX_Extensions

Thoughts?

Andrew Bartlett
-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org




More information about the samba-technical mailing list