From 8a2941c44a3bfedcce91fdcf464b283b2fd76160 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 18 Aug 2008 12:49:59 +0000
Subject: [PATCH] Processor: lock all levels even if one is missing

If a locking level wasn't specified locking used to stop. This means
that if one, for example, didn't specify anything at the LEVEL_INSTANCE
level, no locks at the LEVEL_NODE level were acquired either. With this
patch we force _LockAndExecLU to be called for all existing levels, and
break the recursion if the level doesn't exist in locking.LEVELS.

Reviewed-by: imsnah
---
 lib/mcpu.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/mcpu.py b/lib/mcpu.py
index a802051df..22aa42eac 100644
--- a/lib/mcpu.py
+++ b/lib/mcpu.py
@@ -129,7 +129,9 @@ class Processor(object):
     given LU and its opcodes.
 
     """
-    if level in lu.needed_locks:
+    if level not in locking.LEVELS:
+      result = self._ExecLU(lu)
+    elif level in lu.needed_locks:
       # This gives a chance to LUs to make last-minute changes after acquiring
       # locks at any preceding level.
       lu.DeclareLocks(level)
@@ -146,7 +148,7 @@ class Processor(object):
         if lu.needed_locks[level]:
           self.context.glm.release(level)
     else:
-      result = self._ExecLU(lu)
+      result = self._LockAndExecLU(lu, level + 1)
 
     return result
 
-- 
GitLab