changeset 14196:2ea29ab6f10f

file-dotlock: Avoid "timestamp is different than current time" errors during high disk I/O load.
author Timo Sirainen <tss@iki.fi>
date Tue, 21 Feb 2012 11:08:05 +0200
parents 7d0d76df719f
children a6a58512f0df
files src/lib/file-dotlock.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/file-dotlock.c	Tue Feb 21 03:07:49 2012 +0200
+++ b/src/lib/file-dotlock.c	Tue Feb 21 11:08:05 2012 +0200
@@ -534,8 +534,13 @@
 				try_create_lock_excl(&lock_info, write_pid) :
 				try_create_lock_hardlink(&lock_info, write_pid,
 							 tmp_path, now);
-			if (ret != 0)
+			if (ret != 0) {
+				/* if we succeeded, get the current time once
+				   more in case disk I/O usage was really high
+				   and it took a long time to create the lock */
+				now = time(NULL);
 				break;
+			}
 		}
 
 		if (last_notify != now && set->callback != NULL) {