Use flock, not lockf, for locking in base_job. lockf doesn't work very well
when the actual length and contents of the file are in flux, since we're
really just trying to use the file as one big cross-process semaphore.

Signed-off-by: John Admanski <[email protected]>

--- autotest/client/common_lib/base_job.py      2010-01-21 15:14:24.000000000 
-0800
+++ autotest/client/common_lib/base_job.py      2010-01-29 11:22:50.000000000 
-0800
@@ -189,13 +189,13 @@
         """Acquire a lock on the backing file."""
         if self._backing_file:
             self._backing_file_lock = open(self._backing_file, 'a')
-            fcntl.lockf(self._backing_file_lock, fcntl.LOCK_EX)
+            fcntl.flock(self._backing_file_lock, fcntl.LOCK_EX)
 
 
     def _unlock_backing_file(self):
         """Release a lock on the backing file."""
         if self._backing_file_lock:
-            fcntl.lockf(self._backing_file_lock, fcntl.LOCK_UN)
+            fcntl.flock(self._backing_file_lock, fcntl.LOCK_UN)
             self._backing_file_lock.close()
             self._backing_file_lock = None
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to