Commit 63e6a7f6 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

cmdlib._ReleaseLock: Do nothing if no locks are owned

The locking library doesn't like it when “release()” is called on
a lockset or lock which isn't held by the current thread. Instead
of modifying the library, which could have other side-effects,
this rather simple change avoids errors when a LU simply tries to
release all locks, even when it doesn't own any at a certain level.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 4d4eae2a
......@@ -721,12 +721,17 @@ def _ReleaseLocks(lu, level, names=None, keep=None):
should_release = None
if should_release:
owned = lu.owned_locks(level)
if not owned:
# Not owning any lock at this level, do nothing
elif should_release:
retain = []
release = []
# Determine which locks to release
for name in lu.owned_locks(level):
for name in owned:
if should_release(name):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment