diff --git a/lib/locking.py b/lib/locking.py
index 2144735c73069198795273fb54a978093ea14442..a35c258730b137dc23bc4b5ae75f564379d874f3 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -452,7 +452,7 @@ class LockSet:
       # First we look the locks up on __lockdict. We have no way of being sure
       # they will still be there after, but this makes it a lot faster should
       # just one of them be the already wrong
-      for lname in names:
+      for lname in utils.UniqueSequence(names):
         try:
           lock = self.__lockdict[lname] # raises KeyError if lock is not there
           acquire_list.append((lname, lock))