Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-09-10 23:55:26 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-09-10 23:55:26 +0400
commitf7dea7f23347d847b6abd3d8b5f7e1b00f21262f (patch)
treed79635f25fd609fc9dbab452c51b531fad3a28a7 /winsup
parent396561aa0b5a2b220920ce515799d5a35b03a8cc (diff)
* syscalls.cc (rename): Limit retry loop in case of sharing violation
to about a second.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/syscalls.cc14
2 files changed, 15 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e5bb70a90..cde4f2f13 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2010-09-10 Corinna Vinschen <corinna@vinschen.de>
+ * syscalls.cc (rename): Limit retry loop in case of sharing violation
+ to about a second.
+
+2010-09-10 Corinna Vinschen <corinna@vinschen.de>
+
* syscalls.cc (fstatat): Call stat_worker directly from here.
2010-09-10 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 5c1ec504b..d903da5df 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2009,6 +2009,8 @@ rename (const char *oldpath, const char *newpath)
|| (!removepc && dstpc->has_attribute (FILE_ATTRIBUTE_READONLY))))
start_transaction (old_trans, trans);
+ int retry_count;
+ retry_count = 0;
retry:
/* DELETE is required to rename a file. At least one cifs FS (Tru64) needs
FILE_READ_ATTRIBUTE, otherwise the FileRenameInformation call fails with
@@ -2026,7 +2028,7 @@ retry:
{
debug_printf ("status %p", status);
if (status == STATUS_SHARING_VIOLATION
- && WaitForSingleObject (signal_arrived, 0) != WAIT_OBJECT_0)
+ && WaitForSingleObject (signal_arrived, 10L) != WAIT_OBJECT_0)
{
/* Typical BLODA problem. Some virus scanners check newly generated
files and while doing that disallow DELETE access. That's really
@@ -2036,9 +2038,13 @@ retry:
scanner and the application fails to create the target file.
This kludge tries to work around that by yielding until the
- sharing violation goes away, or a signal arrived. */
- yield ();
- goto retry;
+ sharing violation goes away, or a signal arrived, or after
+ about a second, give or take. */
+ if (++retry_count < 40)
+ {
+ yield ();
+ goto retry;
+ }
}
__seterrno_from_nt_status (status);
goto out;