From f56377a38fb553471ba7c20d17d0b9fa6c8fd141 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 12 Aug 2008 17:00:19 +0000
Subject: [PATCH] Fix race locking issue in noded

Noded didn't release the job queue lock after initialising it. This
patch makes sure to unlock once the work is done.

Reviewed-by: ultrotter
---
 lib/jstore.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/jstore.py b/lib/jstore.py
index 7424b7b7f..4d9189e39 100644
--- a/lib/jstore.py
+++ b/lib/jstore.py
@@ -134,6 +134,11 @@ def InitAndVerifyQueue(must_lock):
         # There must be a serious problem
         raise errors.JobQueueError("Can't read/parse the job queue serial file")
 
+      if not must_lock:
+        # There's no need for more error handling. Closing the lock file below in
+        # case of an error will unlock it anyway.
+        queue_lock.Unlock()
+
   except:
     queue_lock.Close()
     raise
-- 
GitLab