From 9b7e05a6a17605a40ef91a6faefd0af12481ec13 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 27 Nov 2012 07:57:28 +0100
Subject: [PATCH] cmdlib.LUInstanceRename: Another assertion for BGL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Check whether the BGL is actually held instead of just testing
β€œREQ_BGL”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 lib/cmdlib.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index e02945008..82166e069 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -7620,6 +7620,7 @@ class LUInstanceRename(LogicalUnit):
     # Change the instance lock. This is definitely safe while we hold the BGL.
     # Otherwise the new lock would have to be added in acquired mode.
     assert self.REQ_BGL
+    assert self.glm.is_owned(locking.BGL)
     self.glm.remove(locking.LEVEL_INSTANCE, old_name)
     self.glm.add(locking.LEVEL_INSTANCE, self.op.new_name)
 
-- 
GitLab