Blame SOURCES/0009-Add-macros-to-release-GIL-lock.patch

fef8d1
From 676f48d6e70f8406b36a004669d923825db51e2f Mon Sep 17 00:00:00 2001
46c2f0
From: Jiri Konecny <jkonecny@redhat.com>
46c2f0
Date: Mon, 11 May 2015 13:16:26 +0200
46c2f0
Subject: [PATCH] Add macros to release GIL lock
46c2f0
46c2f0
Other threads are blocked when GIL is not released before the time consuming
46c2f0
functions.
46c2f0
---
46c2f0
 libiscsi/pylibiscsi.c | 16 +++++++++++++---
46c2f0
 1 file changed, 13 insertions(+), 3 deletions(-)
46c2f0
46c2f0
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
46c2f0
index 8800853..40b5955 100644
46c2f0
--- a/libiscsi/pylibiscsi.c
46c2f0
+++ b/libiscsi/pylibiscsi.c
46c2f0
@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self)
46c2f0
 static PyObject *PyIscsiNode_login(PyObject *self)
46c2f0
 {
46c2f0
 	PyIscsiNode *node = (PyIscsiNode *)self;
46c2f0
+	int ret;
46c2f0
 
46c2f0
-	if (libiscsi_node_login(context, &node->node)) {
46c2f0
+	Py_BEGIN_ALLOW_THREADS
46c2f0
+	ret = libiscsi_node_login(context, &node->node);
46c2f0
+	Py_END_ALLOW_THREADS
46c2f0
+
46c2f0
+	if (ret) {
46c2f0
 		PyErr_SetString(PyExc_IOError,
46c2f0
 				libiscsi_get_error_string(context));
46c2f0
 		return NULL;
46c2f0
@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
46c2f0
 	const struct libiscsi_auth_info *authinfo = NULL;
46c2f0
 	struct libiscsi_node *found_nodes;
46c2f0
 	PyObject* found_node_list;
46c2f0
+	int ret;
46c2f0
 
46c2f0
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
46c2f0
 					kwlist, &address, &port,
46c2f0
@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
46c2f0
 		}
46c2f0
 	}
46c2f0
 
46c2f0
-	if (libiscsi_discover_sendtargets(context, address, port, authinfo,
46c2f0
-					  &nr_found, &found_nodes)) {
46c2f0
+	Py_BEGIN_ALLOW_THREADS
46c2f0
+	ret = libiscsi_discover_sendtargets(context, address, port, authinfo,
46c2f0
+					    &nr_found, &found_nodes);
46c2f0
+	Py_END_ALLOW_THREADS
46c2f0
+
46c2f0
+	if (ret) {
46c2f0
 		PyErr_SetString(PyExc_IOError,
46c2f0
 				libiscsi_get_error_string(context));
46c2f0
 		return NULL;
46c2f0
-- 
fef8d1
2.26.2
46c2f0