Directory cache and SMB2

Jeremy Allison jra at samba.org
Thu Mar 29 21:34:05 UTC 2018


On Thu, Mar 29, 2018 at 08:15:04PM +0200, Ralph Böhme wrote:
> On Thu, Mar 29, 2018 at 07:47:01PM +0200, Ralph Böhme wrote:
> > On Thu, Mar 29, 2018 at 10:12:42AM -0700, Jeremy Allison wrote:
> > > On Thu, Mar 29, 2018 at 03:43:07PM +0200, Ralph Böhme wrote:
> > > > Hi!
> > > > 
> > > > It seems for SMB2 we still populate the directory cache, but we never use it. Am
> > > > I missing something?
> > > > 
> > > > It gets populated via smbd_smb2_query_directory_send ->
> > > > smbd_dirptr_lanman2_entry -> smbd_dirptr_get_entry -> DirCacheAdd for SMB2.
> > > > 
> > > > But the only point where it's used is via call_trans2findnext -> dptr_SearchDir
> > > > -> SearchDir which is SMB1 only.
> > > 
> > > Yes, that's completely correct. That's because SMB1 uses a name
> > > to resume from, wheras SMB2 always continues from the next position
> > > (unless it's told to restart or close-and-reopen the listing).
> > > 
> > > We could make DirCacheAdd a noop for SMB2. Wanna do a patch ?
> > 
> > yup, I just needed the confirmation before jumping at it. :) Thanks!
> 
> attached, preventing the call to DirCacheAdd() as well as changing the
> initialisation to not allocate the cache array.
> 
> I've logged a bug as I thought this would be worthwile backporting.

LGTM. RB+ and will push as soon as my latest autobuild finishes.

Jeremy.



More information about the samba-technical mailing list