On Mon, Jan 13, 2025 at 9:59 PM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > > Shyam Prasad N <nspmangalore@xxxxxxxxx> writes: > > > Hi Paulo, > > > > Thanks for your replies. > > > > On Mon, Jan 13, 2025 at 8:55 PM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > >> > >> Shyam Prasad N <nspmangalore@xxxxxxxxx> writes: > >> > >> > Ideally, negative dentries should allow a filename lookup to happen > >> > entirely from the dentry cache if the lookup had happened once > >> > already. But I noticed that the SMB client goes to the server every > >> > time we do a stat of a file that does not exist. > >> > >> This is a network filesystem. If the last lookup ended up with a > >> negative dentry in dcache, that doesn't mean the file won't exist the > >> next time we look it up again. The file could have been created by a > >> different client, so we need to query it on server. > > > > I agree. But we do have tools to trade performance for accuracy using > > parameters like actimeo/acdirmax/acregmax. > > Do you mean using these parameters for negative dentries? These are > used for caching file attributes of files and directories, which means > they are all positive dentries. Yes. Precisely. > > > So we can avoid going to the server each time if it's within some interval. > > If the server gives us dir leases, we can be sure that the dentries > > have not changed without us knowing. So we can definitely cache the > > negative dentries till as long as we have the lease. > > Yes, that could be done with directory leases. > > Note that negative dentries are also cached when @lookupCacheEnabled is > set. Ah ok. I need to check about this. My point was that today, if we keep doing a stat for a non existent file in 1 second loop, each call translates to a server QueryInfo, unless dir leases are enabled. -- Regards, Shyam