Added detection of fs unsupported link creation.

Function acquire will run in infinite loop if the fs doesn't support
link creation(OSError: (38, 'Function not implemented'))
This commit is contained in:
Alexandre Beloin 2015-02-08 20:01:30 -05:00
parent c62d8f2c79
commit de6cd8d9f1
1 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,9 @@ class LinkLockFile(LockBase):
# Try and create a hard link to it.
try:
os.link(self.unique_name, self.lock_file)
except OSError:
except OSError as e:
if e.errno == 38:
raise LockFailed("%s" % e.strerror)
# Link creation failed. Maybe we've double-locked?
nlinks = os.stat(self.unique_name).st_nlink
if nlinks == 2: