Blame SOURCES/tuna-Fix-race-in-is_hardirq_handler.patch

d2f14d
From a4fdd27814ed7b4f2f6f609a72364b581ec19bc0 Mon Sep 17 00:00:00 2001
d2f14d
From: Arnaldo Carvalho de Melo <acme@felicio.ghostprotocols.net>
d2f14d
Date: Tue, 9 Jun 2015 16:15:42 -0300
d2f14d
Subject: [PATCH 12/15] tuna: Fix race in is_hardirq_handler
d2f14d
d2f14d
It is better to try accessing the fields catching exceptions, as just
d2f14d
checking if we have that key is not enough for, right after, that thread
d2f14d
having gone away and the populating of that dict entry not finding the
d2f14d
file on /proc/PID/.
d2f14d
d2f14d
Signed-off-by: Arnaldo Carvalho de Melo <acme@felicio.ghostprotocols.net>
d2f14d
Signed-off-by: John Kacur <jkacur@redhat.com>
d2f14d
---
d2f14d
 tuna/tuna.py | 7 ++++---
d2f14d
 1 file changed, 4 insertions(+), 3 deletions(-)
d2f14d
d2f14d
diff --git a/tuna/tuna.py b/tuna/tuna.py
d2f14d
index 6cd6bddd2137..3c30f03ea134 100755
d2f14d
--- a/tuna/tuna.py
d2f14d
+++ b/tuna/tuna.py
d2f14d
@@ -166,10 +166,11 @@ def list_to_cpustring(l):
d2f14d
 # FIXME: move to python-linux-procfs
d2f14d
 def is_hardirq_handler(self, pid):
d2f14d
 		PF_HARDIRQ = 0x08000000
d2f14d
-		if not self.processes.has_key(pid):
d2f14d
+		try:
d2f14d
+			return int(self.processes[pid]["stat"]["flags"]) & \
d2f14d
+				PF_HARDIRQ and True or False
d2f14d
+		except:
d2f14d
 			return False
d2f14d
-                return int(self.processes[pid]["stat"]["flags"]) & \
d2f14d
-                       PF_HARDIRQ and True or False
d2f14d
 
d2f14d
 # FIXME: move to python-linux-procfs
d2f14d
 def cannot_set_affinity(self, pid):
d2f14d
-- 
d2f14d
1.8.3.1
d2f14d