diff mbox series

utils: Improve multiple lock handling

Message ID 20241011105954.739139-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 4fbef87adaca2df8c1e877aec5588c2e5466f252
Headers show
Series utils: Improve multiple lock handling | expand

Commit Message

Richard Purdie Oct. 11, 2024, 10:59 a.m. UTC
We should release locks in the opposite order to the order we locked
them in to avoid potentially problematic behaviour. This hasn't been
observed with our current usage and is just a preventative improvement.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/utils.py | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index ebee65d3dd..e722f9113d 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -446,6 +446,7 @@  def fileslocked(files, *args, **kwargs):
     try:
         yield
     finally:
+        locks.reverse()
         for lock in locks:
             bb.utils.unlockfile(lock)