summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-17 15:07:11 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-22 06:13:43 -0700
commit80f5d11c731eb286f55b21b35015943e2bbb1f8b (patch)
treed4fd7e37092ece81e3deb3954ff73dc21b095972
parentc179755dd1068e480e3d371dd9fafa94faee90aa (diff)
protocol/client: access glusterfs context from the ctx member of xlator object
- A global context pointer cannot be used with libglusterfsclient, since there can be many contexts in a single process. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 271 (applications using booster protocol/client crash in client_setvolume_cbk.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=271
-rw-r--r--libglusterfs/src/common-utils.c7
-rw-r--r--xlators/protocol/client/src/client-protocol.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 9efb9625995..624e785dd04 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -235,6 +235,13 @@ set_global_ctx_ptr (glusterfs_ctx_t *ctx)
gf_global_ctx = ctx;
}
+/*
+ * Don't use this function other than in glusterfsd.c. libglusterfsclient does
+ * not set gf_global_ctx since there can be multiple glusterfs-contexts
+ * initialized in a single process. Instead access the context from ctx member
+ * of the xlator object.
+ */
+
glusterfs_ctx_t *
get_global_ctx_ptr (void)
{
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index e5b407e24ed..b46a622f996 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -5708,7 +5708,7 @@ client_setvolume_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
if (!remote_subvol)
goto out;
- ctx = get_global_ctx_ptr ();
+ ctx = this->ctx;
if (process_uuid && !strcmp (ctx->process_uuid,process_uuid)) {
ret = dict_get_uint64 (reply, "transport-ptr",