Bug 10140 - SMB2 Client Redirector Cache
Summary: SMB2 Client Redirector Cache
Status: RESOLVED INVALID
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: SMB2 (show other bugs)
Version: 3.6.18
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
: 10091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-14 09:12 UTC by Klaus Braun
Modified: 2015-03-11 03:38 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Braun 2013-09-14 09:12:13 UTC
Dear Samba,

on my Windows 7 computer which is connected to samba using SMB2 I 
experience a behavior which obviously is correlated to the SMB2
Client Redirector Cache explained by Microsoft in

http://technet.microsoft.com/en-us/library/ff686200(v=ws.10).aspx

The problem is, that a specific applicaiton (ArcGIS from ESRI) creates
empty files on the samba share to indicate that specific files are
locked. Because these "lock files" are not visible for ArcGIS
immediately the software complains about not being able to get a 
lock.

The problem can be solved by setting DirectoryCacheLifetime to ZERO
as mentioned by Microsoft in the article above.

In 

http://stackoverflow.com/questions/5159220/windows-file-share-why-sometimes-newly-created-files-arent-visible-for-some-pe

it is said that problems like this are found on Windows Server 2008 R2.

My question is, if anyone knows if this problem is solved in later
releases of Windows Server and if so if it will be solved on samba.

Or if it is a problem resulting from the design of the SMB2 Client
Redirector Cache and could not be solved, in which case for some
applications like my ArcGIS it is necessary to disable some of the 
caches listed in the Microsoft article.

It would be great if if anyone could help to answer this question.

Thanks

Klaus
Comment 1 Klaus Braun 2013-09-14 09:15:19 UTC
*** Bug 10091 has been marked as a duplicate of this bug. ***
Comment 2 Jeremy Allison 2013-09-25 14:45:31 UTC
So reading that article, this is a fundamental design issue with the directory cache in the SMB2 redirector, that cannot be fixed in Samba.

Essentially the client is caching directory listing data for 10 seconds without the ability for the server to invalidate it. There's nothing we can do about this.

Applications can use directory change notify (which we do support) to receive notifications of directory changes to invalidate this cache - which is why things work when Windows explorer is open on the directory - but unless the application specifically requests this we can't tell the client to invalidate its cache.

The only solution as specified in the article is to disable the cache using the registry entry listed:

"Setting HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation\Parameters\DirectoryCacheLifetime (DWORD) to a value of 0 will disable the cache and resolve the file doesn't exist issue."

Jeremy.