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

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