This is an automated email from the git hooks/post-receive script.
teigland pushed a change to branch master in repository sanlock.
from 672dbb1 release 3.6.0 new e1f3e40 python: add thread lock around register
The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference.
Summary of changes: python/sanlock.c | 5 +++++ 1 file changed, 5 insertions(+)
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master in repository sanlock.
commit e1f3e409c98f6c638d33ba3747005e85577b01a8 Author: Nir Soffer nsoffer@redhat.com Date: Mon Dec 11 09:42:39 2017 -0600
python: add thread lock around register
In the current implementation, sanlock_register shouldn't block, but we should not take any chance, since blocking will hang all threads in the caller process.
It is also easier to maintain when we decouple the implementation from the python glue layer; we don't want to modify locking in the python binding when we we modify the underlying library.
Signed-off-by: Nir Soffer nsoffer@redhat.com --- python/sanlock.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/python/sanlock.c b/python/sanlock.c index 0ef1174..3142b2a 100644 --- a/python/sanlock.c +++ b/python/sanlock.c @@ -54,6 +54,7 @@ __set_exception(int en, char *msg) en = -en; err_name = strerror(en); } else { + /* Safe to call without releasing the GIL. */ err_name = sanlock_strerror(en); }
@@ -213,7 +214,11 @@ py_register(PyObject *self __unused, PyObject *args) { int sanlockfd;
+ /* This sholdn't block, but we don't want to take any chance, as blocking + * hangs all threads in the caller process. */ + Py_BEGIN_ALLOW_THREADS sanlockfd = sanlock_register(); + Py_END_ALLOW_THREADS
if (sanlockfd < 0) { __set_exception(sanlockfd, "Sanlock registration failed");
sanlock-devel@lists.fedorahosted.org