Wednesday, 15 September 2010

locking - Exclusive file lock on windows, slowness -


I am trying to use unique file locking as a lock between processes running on a different host. Most of the time it works fine either it succeeds or returns ERROR_SHARING_VIOLATION in a loop I do:

  CreateFileW (name, FILE_APPEND_DATA, FILE_SHARE_DELETE, zero, OPEN_ALWAYS, // open or create FILE_FLAG_DELETE_ON_CLOSE, // pass the file at zero);  

From time to time, this return ERROR_ACCESS_DENIED but again successful

issue. On rare occasions: Launching Process Stacks on opening the file: Let's succeed, but the rest say (20 processes) locked file for some important amount (50 minutes) is showing and its timeline has updated. .

Then a process was found, and after some time, all the reminder processes successfully (like a few seconds) relatively short time

then 2 questions

  1. How to fix such behavior
  2. Minor questions? Why returned ERROR_ACCESS_DENIED <. / Li>

thanks

environment:

  • File R2 on Windows Server
  • Program R2 Protocols on Windows 2008
  • SMB 2.1

ACCESS_DENIED probability is:

If you call CreateFile on a file that has a pending deletion as a result of a previous call to DeleteFile, fails on the functionality, delaying the operating system until the file is deleted Till all the handles in the file are not closed Ati. GetLastError returns ERROR_ACCESS_DENIED.

You do not have the DeleteFile phone, but you do an equivalent job.

You did not quite say what was the undesirable part of the behavior. You see that I feel stuck - in which case I advise you to try to add the FILE_COMPLETE_IF_OPLOCKED flag.

One more thing that can be influenced by you is that it is a tunnel and remove it - look at it. So disable the tunnel and see what it brings to you.

To further diagnose, you want to run a propon trace on both the affected clients and servers, which are the affected SMB shares.


No comments:

Post a Comment