summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-04-16 12:16:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-04-16 12:16:35 +0000
commit03897d8dda6706148fb7aae9e86730d4b5840e22 (patch)
treeeece64961eb880e4a723ff470122971ef5c8a61d /winsup/cygwin/syscalls.cc
parent8c3a79bb97bec5b218c8d6d5627698091c408fef (diff)
downloadcygnal-03897d8dda6706148fb7aae9e86730d4b5840e22.tar.gz
cygnal-03897d8dda6706148fb7aae9e86730d4b5840e22.tar.bz2
cygnal-03897d8dda6706148fb7aae9e86730d4b5840e22.zip
* 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.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc14
1 files changed, 12 insertions, 2 deletions
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;