python/sanlockmod.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 70e18d301a967b996ed1882b49a3bf91d2fb175e
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Mon Apr 18 16:26:45 2011 +0100
python: register process only once
diff --git a/python/sanlockmod.c b/python/sanlockmod.c
index 789246a..9d214f5 100644
--- a/python/sanlockmod.c
+++ b/python/sanlockmod.c
@@ -60,9 +60,9 @@ __parse_resource(char *resource, struct sanlk_resource **ret_res)
static PyObject *
py_register(PyObject *self, PyObject *args)
{
- Py_BEGIN_ALLOW_THREADS
- __sanlockmod_fd = sanlock_register();
- Py_END_ALLOW_THREADS
+ if (__sanlockmod_fd < 0) {
+ __sanlockmod_fd = sanlock_register();
+ }
if (__sanlockmod_fd < 0) {
PyErr_SetString(sanlockmod_exception, "SANLock registration failed");