From de6cd8d9f1cb62f34f6a597f9578ecd0d11e9f3a Mon Sep 17 00:00:00 2001 From: Alexandre Beloin Date: Sun, 8 Feb 2015 20:01:30 -0500 Subject: [PATCH] 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')) --- lib/lockfile/linklockfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/lockfile/linklockfile.py b/lib/lockfile/linklockfile.py index 9c506734..d407848c 100644 --- a/lib/lockfile/linklockfile.py +++ b/lib/lockfile/linklockfile.py @@ -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: