summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2012-08-27 19:54:20 +0530
committerVijay Bellur <vbellur@redhat.com>2012-09-24 04:09:58 -0700
commit5ad96fb5a8c79fe50c21a726a7cbda4eaa3b96cc (patch)
tree73585bf9c8b4ddcd50f8ad17ba45de2e692a43e7 /xlators/features
parent373b25827f0250d11461fbe76dd6a0e295069171 (diff)
geo-rep / gsyncd: gsyncd binary wrapper context fixes
Changes to __gf_calloc (commit ed4b76ba) triggers a recursive sequence of _gf_log() and __glusterfs_this_location() calls. This is due to __gf_calloc() trying to access THIS which is not valid in the context of geo replication binary wrapper. This patch fixes the problem by introducing the relevant context in the wrapper. Change-Id: I32b0b6927074692dbf66bad2f3e93434201aaa82 BUG: 846569 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/3859 Reviewed-by: Csaba Henk <csaba@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/marker/utils/src/Makefile.am1
-rw-r--r--xlators/features/marker/utils/src/gsyncd.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/xlators/features/marker/utils/src/Makefile.am b/xlators/features/marker/utils/src/Makefile.am
index 73c99cb76..de23fb556 100644
--- a/xlators/features/marker/utils/src/Makefile.am
+++ b/xlators/features/marker/utils/src/Makefile.am
@@ -13,6 +13,7 @@ noinst_HEADERS = procdiggy.h
AM_CFLAGS = -fPIC -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src\
-DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\
+ -DUSE_LIBGLUSTERFS\
-DSBIN_DIR=\"$(sbindir)\" -DPYTHON=\"$(PYTHON)\"
diff --git a/xlators/features/marker/utils/src/gsyncd.c b/xlators/features/marker/utils/src/gsyncd.c
index cdf282673..a45873a71 100644
--- a/xlators/features/marker/utils/src/gsyncd.c
+++ b/xlators/features/marker/utils/src/gsyncd.c
@@ -19,6 +19,17 @@
#include <string.h>
#include <sys/param.h> /* for PATH_MAX */
+/* NOTE (USE_LIBGLUSTERFS):
+ * ------------------------
+ * When USE_LIBGLUSTERFS debugging sumbol is passed; perform
+ * glusterfs translator like initialization so that glusterfs
+ * globals, contexts are valid when glustefs api's are invoked.
+ * We unconditionally pass then while building gsyncd binary.
+ */
+#ifdef USE_LIBGLUSTERFS
+#include "glusterfs.h"
+#include "globals.h"
+#endif
#include "common-utils.h"
#include "run.h"
@@ -290,6 +301,19 @@ main (int argc, char **argv)
char *b = NULL;
char *sargv = NULL;
+#ifdef USE_LIBGLUSTERFS
+ glusterfs_ctx_t *ctx = NULL;
+
+ ctx = glusterfs_ctx_new ();
+ if (!ctx)
+ return ENOMEM;
+
+ if (glusterfs_globals_init (ctx))
+ return 1;
+
+ THIS->ctx = ctx;
+#endif
+
evas = getenv (_GLUSTERD_CALLED_);
if (evas && strcmp (evas, "1") == 0)
/* OK, we know glusterd called us, no need to look for further config