How to Disable SMB2 Caching on a per application basis, or how to detect SMB2 ? RRS feed

  • Question

  • In a large legacy application, a lot of multiuser synchronisation is happening using a simple system whereby a workstation makes a file on the network and expects other workstations to see this file.  The original workstation deletes the file when other workstations are free to proceed.  A sort of rudimentary cross-workstation Mutex in other words.

    This worked well enough so far, but is now broken when SMB2.0 is in use (Server 2008 + Vista clients).

    Due to this being legacy, I can't afford to rewrite and spend a lot of time on this.

    Now... while a lot of places this sort of checks are done, there's only a few places that are actually trying to prevent access.  So I see several ways out of this...

    1) Disable SMB2.0 caching for the application only.  Disabling SMB2 entirely is a performance penalty I'm not sure we can impose upon the users (I doubt it)...  Is this possible ?
    2) Somehow 'force' a reread of the cache, But since checking happens a lot, I can't afford just waiting the timeout period here. It does need to force a reread "now".  Is this possible ?
    3) Is it possible to programmatically detect that connection to a specific server is happening with SMB2 ?  Since the actions that impose restrictions are rather limited, I could "chicken out" with a simple messagebox, a disclaimer and some minor tweaks to the code (not ideal, but acceptable in this case).  But I don't want to give this messagebox when I don't have to.

    Monday, September 14, 2009 1:45 PM


  • Hi Customer,


    For the 1st question, as far as I know, it is not possible to control SMB 2.0 cache behavior for application only. Based on my research, You can create registry keys below to control the cache lifetime.








    They are all REG_DWORD type in seconds.


    For your reference, you can refer to the link here:



    For the remaining questions, as they are related to development, I would like to suggest that you initial a new thread in one of the MSDN forum for better and accurate answer to the question. The community members and support professionals there are more familiar with coding and can help you in a more efficient way.


    MSDN forum



    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Wilson Jia Thursday, September 17, 2009 2:50 AM
    Tuesday, September 15, 2009 8:07 AM