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:
parent
c62d8f2c79
commit
de6cd8d9f1
|
@ -28,7 +28,9 @@ class LinkLockFile(LockBase):
|
||||||
# Try and create a hard link to it.
|
# Try and create a hard link to it.
|
||||||
try:
|
try:
|
||||||
os.link(self.unique_name, self.lock_file)
|
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?
|
# Link creation failed. Maybe we've double-locked?
|
||||||
nlinks = os.stat(self.unique_name).st_nlink
|
nlinks = os.stat(self.unique_name).st_nlink
|
||||||
if nlinks == 2:
|
if nlinks == 2:
|
||||||
|
|
Loading…
Reference in New Issue