summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/ctx.c4
-rw-r--r--libglusterfs/src/glusterfs.h5
-rw-r--r--libglusterfs/src/xlator.c2
3 files changed, 10 insertions, 1 deletions
diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c
index b009e6270a2..d3fb39822d1 100644
--- a/libglusterfs/src/ctx.c
+++ b/libglusterfs/src/ctx.c
@@ -37,6 +37,10 @@ glusterfs_ctx_new ()
ctx->log.loglevel = DEFAULT_LOG_LEVEL;
+#ifdef RUN_WITH_VALGRIND
+ ctx->cmd_args.valgrind = _gf_true;
+#endif
+
/* lock is never destroyed! */
ret = LOCK_INIT (&ctx->lock);
if (ret) {
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 4f1f27b5857..ce0dde22d4a 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -401,6 +401,11 @@ struct _cmd_args {
#ifdef GF_LINUX_HOST_OS
char *oom_score_adj;
#endif
+
+ /* Run this process with valgrind? Might want to prevent calling
+ * functions that prevent valgrind from working correctly, like
+ * dlclose(). */
+ int valgrind;
};
typedef struct _cmd_args cmd_args_t;
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 408012e7846..b1ed094e0ae 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -673,7 +673,7 @@ xlator_members_free (xlator_t *xl)
GF_FREE (xl->name);
GF_FREE (xl->type);
- if (xl->dlhandle)
+ if (!(xl->ctx && xl->ctx->cmd_args.valgrind) && xl->dlhandle)
dlclose (xl->dlhandle);
if (xl->options)
dict_unref (xl->options);