Ralph, Looking at the problem you noted with multiple directory listings (ie 'readdir') for the same directory not being served out of the directory cache on the Linux client (as the 'stat' calls after 'readdir' will be) - I noticed that in cifs_readdir() in fs/smb/client/readdir.c we are failing here - dirents.is_valid is not set. I want to dig into this more in the next few days and fix that (and the missing 'H' in the lease request) /* * If we already have the entire directory cached then * we can just serve the cache. */ if (cfid->dirents.is_valid) { ... On Tue, Oct 29, 2024 at 5:05 AM Ralph Boehme <slow@xxxxxxxxx> wrote: > > Hi Steve, > > On 10/28/24 10:11 PM, Steve French wrote: > > Doing some additional experiments to Windows and also to the updated > > Samba branch from Ralph, I see the directory lease request, and > > I see that after ls (which will cache the directory contents for about > > 30 second) we do get a big benefit from the metadata of the directory > > entries being cached e.g. "ls /mnt ; sleep 10; stat /mnt/file ; sleep > > 15 stat /mnt/file2 ; sleep 10 /mnt/file" - we only get the roundtrips > > for the initial ls - the stat calls don't cause any network traffic > > since the directory is cached. > indeed, I can confirm that some cache is used for stat. Unfortunately it > isn't used for readddir. > > Also, coming back on the issue that the client is deferring a close on > the directory with having a H lease: > > In my understanding that's at least going to cause problems if other > clients want to do anything on the server that is not allowed if there > are conflicting opens like renaming a directory (which is not allowed if > there are any opens below recursively). Unlinks will also be deferred as > long as the client sticks to its handle. > > The client should acquire a RH lease on directories if it wants to cache > the handle and that's a prerequisite in order to cache readdir. > > Afair the kernel is currently caching for 30 seconds. Increasing this > time should not be done without also having a H lease. > > -slow -- Thanks, Steve -- Thanks, Steve