# HG changeset patch # User Paul Boddie # Date 1446831686 -3600 # Node ID a04c967b2d8e7b460f1aa9ad39e182acb40ab646 # Parent cad23243f170b78e48a74b8df43a9542293efcca Removed the complicated "old" lock directory mechanism since the active lock directory should be protected by the "outside-in" attempts to create it while the dismantling operation occurs "inside-out". diff -r cad23243f170 -r a04c967b2d8e imiptools/filesys.py --- a/imiptools/filesys.py Fri Nov 06 18:34:33 2015 +0100 +++ b/imiptools/filesys.py Fri Nov 06 18:41:26 2015 +0100 @@ -82,7 +82,6 @@ "Basic filesystem operations." lock_name = "__lock__" - old_lock_name = "__unlock__" def __init__(self, store_dir): self.store_dir = abspath(store_dir) @@ -170,26 +169,12 @@ "Remove the lock directory defined by the given 'parts'." parts = parts and list(parts) or [] - target = parts[:] - - # Move the directory to a unique name. This prevents unlikely but - # possible conflicts as a slow unlocking process is caught up by a - # following, faster locking-then-unlocking process which would then - # try and rename the active lock directory to a common old lock - # directory name, causing a "directory not empty" exception and the - # continued existence of the lock. parts.append(self.lock_name) - old_lock_name = "%s.%d" % (self.old_lock_name, getpid()) - target.append(old_lock_name) - rename(self.get_object_in_store(*parts), self.get_object_in_store(*target)) - - # Then remove the moved directory and its contents. - - target.append(str(getpid())) - rmdir(self.get_object_in_store(*target)) - target.pop() - rmdir(self.get_object_in_store(*target)) + parts.append(str(getpid())) + rmdir(self.get_object_in_store(*parts)) + parts.pop() + rmdir(self.get_object_in_store(*parts)) def owning_lock_dir(self, *parts):