From 03897d8dda6706148fb7aae9e86730d4b5840e22 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 16 Apr 2009 12:16:35 +0000 Subject: * ntdll.h (STATUS_LOCK_NOT_GRANTED): Define. * syscalls.cc (unlink_nt): Handle STATUS_LOCK_NOT_GRANTED same as STATUS_SHARING_VIOLATION. Add lengthy comment to explain why. --- winsup/cygwin/syscalls.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/syscalls.cc') diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 7e684e561..64c25348e 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -470,8 +470,18 @@ unlink_nt (path_conv &pc) we can go straight to setting the delete disposition flag. */ bin_status bin_stat = dont_move; status = NtOpenFile (&fh, access, &attr, &io, FILE_SHARE_DELETE, flags); - if (status == STATUS_SHARING_VIOLATION) - { + if (status == STATUS_SHARING_VIOLATION || status == STATUS_LOCK_NOT_GRANTED) + { + /* STATUS_LOCK_NOT_GRANTED can be generated under not quite clear + circumstances when trying to open a file on NFS with FILE_SHARE_DELETE + only. This has been observed with SFU 3.5 if the NFS share has been + mounted under a drive letter. It's not generated for all files, but + only for some. If it's generated once for a file, it will be + generated all the time. It looks like wrong file state information + is stored within the NFS client, for no apparent reason, which never + times out. Opening the file with FILE_SHARE_VALID_FLAGS will work, + though, and it is then possible to delete the file quite normally. */ + /* Bin is only accessible locally. */ if (!pc.isremote ()) bin_stat = move_to_bin; -- cgit v1.2.3