Home > file management, troubleshooting, vista, windows > Vista Offline Files and SMB Opportunistic Locks

Vista Offline Files and SMB Opportunistic Locks

One of our techs recently ran across a problem with a new Windows Vista Business laptop trying to synchronize offline files to a Windows Server 2000 file server. Synchronization would start, but the Sync Center in Vista would show failures for every single file that was attempted to be sync’d. The error message read something to the extent of “The process cannot access the file because it is being used by another process“.

We tried the usual: checking permissions on the folders being offline’d (I know that’s probably not a word, but you get what I mean); deleting his local cache of Offline Files; disabling and then re-enabling Offline Files. But we just kept on banging our heads against the same error. At first, just about any web search for the error resulted in either something about Windows Home Server or databases or something of the like. Eventually, though, we struck gold:

http://support.microsoft.com/kb/296264/en-us: Configuring opportunistic locking in Windows

According to MS, opportunistic locking “lets clients lock files and locally cache information without the risk of another user changing the file“. Opportunistic Locking is a feature of SMB. It is enabled by default, and is configurable from the client side (i.e. request opportunistic locking or not) and on the server side (i.e. allow opportunistic locking on local files or not).

Also note: “If you disable opportunistic locking, the offline files feature in Windows Vista fails

So, apparently, “The process cannot access the file because it is being used by another process” actually means “Opportunistic locking is not enabled on the file server“. Nice…

Be aware that this setting is changed through the registry, so the regular warnings about messing about in REGEDIT apply (read Disclaimer). That stuff is already listed in the KB, so I won’t bother to repeat it.

To enable opportunistic locking on the file server, open REGEDIT to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters, and change the value of the REG_DWORD
EnableOplocks from 0 to 1.

The server does need to be rebooted in order for the registry change to take effect. After rebooting, retry your offline files synchronization. If the opportunistic locking was your problem, you should be good to go!


I must also thank Rainier Day for his post on his struggles with Opportunistic Locking. He was hit from the other side: The server-side opslock settings were good, but his Vista clients were configured to not request opportunistic locks, and this caused the clients to also experience offline files synchronization errors. Thanks Ranier: I noticed that component in the MS KB, but had never actually come across a Vista workstation that was configured out-of-the-box to have OpsLocks disabled!



  1. Jeff
    2008-04-21 at 07:14

    Note also that when you turn ON the OppLock feature, you will likely get database corruption from any database system that is not client-server (Access, FoxPro, etc.). Do a quick search on this and you’ll find a LOT of issues described out there.

  2. justanothersysadmin
    2008-04-21 at 09:04

    Hi Jeff,

    Thanks for the heads-up: I was not aware of that caveat.

  3. Yashiro
    2008-05-20 at 10:38

    How about the solution if I used a NAS as file server ?

  4. Yashiro
    2008-05-22 at 22:26

    any body here ?
    I need for help ~~~~

  5. justanothersysadmin
    2008-05-23 at 23:53

    Hi Yashiro,

    I’m not exactly sure I know what scenario you’re talking about. If you’re referring to a situation where you have a Vista client workstation trying to use offline files for data stored on a NAS device, your problem could either be client-side on the Vista machine, or the NAS device simply might not support Vista Offline Files.

    I would check with the NAS vendor on whether opportunistic locks can be configured on the NAS device, and if so how to go about it.

    I’m sorry that I can’t be of more help. If you do get any info from your NAS vendor, please be sure to post the Model of the NAS here and some info on the response they gave you. I would be interested to see how that turns out.

  6. techydude
    2009-07-27 at 19:50

    thankyou thankyou thankyou!
    my Vista offline file sync was working, then mysteriously stopped working at some stage. hopefully this’ll resume working after the next reboot.

    Jeff’s comment above is quite right though, some old file-based non-client/server database apps (eg. Foxpro & dBase based) need opp-file-locking disabled.

  7. Andrew
    2011-05-19 at 06:23

    Thanks for this tip – I was just about to toss my new Win7 tablet!

    A while back, I had disabled oplocks on my NAS as part of troubleshooting in a mixed Win/Mac environment.

    Having just received a new Windows 7 machine I was getting repeated failure messages for setting up Offline Files.

    Having re-enabled oplocks on the NAS, Offline Files appear to be syncing OK.

  1. 2008-06-20 at 14:16
  2. 2010-09-25 at 11:50

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: