diff options
| -rw-r--r-- | libglusterfs/src/xlator.c | 4 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 2 | ||||
| -rw-r--r-- | xlators/features/glupy/src/glupy.c | 19 | 
3 files changed, 22 insertions, 3 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 3e9814ca19b..b060d393730 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -170,7 +170,7 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,          gf_msg_trace ("xlator", 0, "attempt to load file %s", name); -        handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL); +        handle = dlopen (name, RTLD_NOW);          if (!handle) {                  gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLOPEN_FAILED,                          "%s", dlerror ()); @@ -427,7 +427,7 @@ xlator_dynload (xlator_t *xl)          gf_msg_trace ("xlator", 0, "attempt to load file %s", name); -        handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL); +        handle = dlopen (name, RTLD_NOW);          if (!handle) {                  gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLOPEN_FAILED,                          "%s", dlerror ()); diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 40c41ab7016..9497ecf78e5 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -279,7 +279,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)  	gf_log ("rpc-transport", GF_LOG_DEBUG,  		"attempt to load file %s", name); -	handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL); +        handle = dlopen (name, RTLD_NOW);  	if (handle == NULL) {  		gf_log ("rpc-transport", GF_LOG_ERROR, "%s", dlerror ());  		gf_log ("rpc-transport", GF_LOG_WARNING, diff --git a/xlators/features/glupy/src/glupy.c b/xlators/features/glupy/src/glupy.c index bca476427c8..46d1af5533a 100644 --- a/xlators/features/glupy/src/glupy.c +++ b/xlators/features/glupy/src/glupy.c @@ -9,6 +9,7 @@  */  #include <ctype.h> +#include <dlfcn.h>  #include <sys/uio.h>  #include <Python.h> @@ -2331,6 +2332,7 @@ init (xlator_t *this)  	PyObject                *error_bt       = NULL;  	static gf_boolean_t      py_inited      = _gf_false;          void *                   err_cleanup    = &&err_return; +        char                     libpython[16];          if (dict_get_str(this->options,"module-name",&module_name) != 0) {                  gf_log (this->name, GF_LOG_ERROR, "missing module-name"); @@ -2345,6 +2347,23 @@ init (xlator_t *this)          err_cleanup = &&err_free_priv;  	if (!py_inited) { +                /* FIXME: +                 * This hack is necessary because glusterfs (rightly) loads +                 * glupy.so with RTLD_LOCAL but glupy needs libpython to be +                 * loaded with RTLD_GLOBAL even though glupy is correctly +                 * linked with libpython. +                 * This is needed because one of the internal modules of +                 * python 2.x (lib-dynload/_struct.so) does not explicitly +                 * link with libpython. +                 */ +                snprintf(libpython, sizeof(libpython), "libpython%d.%d.so", +                         PY_MAJOR_VERSION, PY_MINOR_VERSION); +                if (!dlopen (libpython, RTLD_NOW|RTLD_GLOBAL)) { +                        gf_msg (this->name, GF_LOG_WARNING, 0, +                                LG_MSG_DLOPEN_FAILED, "dlopen(%s) failed: %s", +                                libpython, dlerror ()); +                } +  	        /*                    * This must be done before Py_Initialize(),                   * because it will duplicate the environment,  | 
