File Lock or Access Denied Error Message When You Save Files Over the Network (812937)



The information in this article applies to:

  • Microsoft Windows XP 64-Bit Edition
  • Microsoft Windows XP Home Edition SP1
  • Microsoft Windows XP Professional SP1
  • Microsoft Windows XP Tablet PC Edition

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

When you try to save a file such as a Microsoft Excel workbook that you opened by using a universal naming convention (UNC) path, you may receive an error message that is similar to one of the following:
Cannot read file. File is locked
Access Denied
Lock Error
Event Viewer may contain the following event:Event Type: Information
Event Source: Application Popup
Event Category: None
Event ID: 26
User: N/A
Description: Application popup: Windows - Delayed Write Failed : Windows was unable to save all the data for the file name_of_the_file_you_want_to_save. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere. For more information, see Help and Support Center at http://support.microsoft.com.

CAUSE

This problem occurs when the redirector flushes the contents of the file, and writes to a file handle with read-only access instead of to a file handle with write access. When the redirector received an opportunistic lock break to none, it purged the cache for the file, but did not uninitialize the cache for the file. The redirector also needed to purge and uninitialize when the set end of file occurs because the opportunistic lock break is asynchronous. Because it did not uninitialize the cache for the file, it wrote to the incorrect file handle.

RESOLUTION

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft Windows XP. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack

Hotfix information

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Windows XP service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

Windows XP SP1, Windows XP Tablet PC Edition

Date        Time  Version       Size      File name 
-------------------------------------------------------------- 
30-Jan-2003 21:41 5.1.2600.1164 400,896   Mrxsmb.sys 
30-Jan-2003 21:41 5.1.2600.1164 154,880   Rdbss.sys

Windows XP 64-Bit Edition

Date         Time  Version       Size      File name 
------------------------------------------------------------- 
30-Jan-2003  21:41 5.1.2600.1164 1,259,392 Mrxsmb.sys 
30-Jan-2003  21:41 5.1.2600.1164 489,216   Rdbss.sys


WORKAROUND

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk. To work around this problem, disable opportunistic locking on the file server:
  1. Click Start, and then click Run.
  2. In the Open box, type regedit, and then press ENTER.
  3. In Registry Editor, locate the following subkey in the registry:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\LanmanServer\Parameters

  4. In the right pane, click EnableOplocks, and then press ENTER.
  5. In the Value data box, type 0, and then press ENTER.
  6. Quit Registry Editor.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Windows XP Service Pack 2.

MORE INFORMATION

For additional information about opportunistic locking, click the following article number to view the article in the Microsoft Knowledge Base:

296264 Configuring Opportunistic Locking in Windows 2000

A trace of this problem shows that the file is opened at least two times, and shows the system improperly writing to the read-only file handle. A trace that shows this problem is similar to the following:
96  CLIENT SMB: C NT create & X, File = \newshare.xls
           SMB: Desired Access = 0x00020089 
	  (Read Data,Read EA,Read Attributes)
97  SERVER SMB: R NT create & X, FID = 0x5
  	  SMB: Oplock Level = Batch

<content removed that displays the client program reading and locking the file, but the file is not closed>

450 CLIENT SMB: C NT create &amp; X, File = \newshare.xls
  	   SMB: Desired Access = 0x0002019F 
	   (Read/Write Data, Read/Write EA, Read/Write Attributes)

451 SERVER SMB: R NT create &amp; X, FID = 0xc007
	   SMB: Oplock Level = NONE

<content removed that displays the client program reading, locking,  writing and flushing data on this file handle>

585 CLIENT SMB: C write &amp; X, FID = 0x5, Write 0xc00 at 0x00005000
		PID = 0xFEFF TID = 0x1002 MID = 0x4400 UID = 0x0801
586 SERVER SMB: R write &amp; X - NT error, System, Error, Code = (34) STATUS_ACCESS_DENIED
Note The process identifier (PID) of 0xFEFF in frame 585 represents the client system process that is using the read-only file handle. It does not show the client program writing the data to disk.

Modification Type:MajorLast Reviewed:9/20/2006
Keywords:kbHotfixServer kbQFE kbWinXPsp2fix kbenv kbQFE kberrmsg kbWinXPpreSP2fix kbfix kbbug KB812937