summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-12-28 19:31:36 +0530
committerDan Lambright <dlambrig@redhat.com>2016-02-22 06:53:50 -0800
commit64b964187e413879269dd7e5ede44c16fc6efc5e (patch)
tree7135023ded0ca59731a327bf096da31455563e50 /xlators/cluster/dht
parent40902503da073bb106ba0eef7788692f0cfcfc20 (diff)
tier/create: Dynamically allocate gfid memory
Currently we are storing the memory as a static pointer. There is a chance to go that variable in out of scope. So we should allocate in Dynamic way. Backport of> >Change-Id: I096876deb8055ac3a44681599591a0a032bc0c24 >BUG: 1290677 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/13102 >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: N Balachandran <nbalacha@redhat.com> >Reviewed-by: Dan Lambright <dlambrig@redhat.com> >Tested-by: Dan Lambright <dlambrig@redhat.com> Change-Id: Ibc5cde24db4846ef3152366cdaca81dd1d0e7b21 BUG: 1295359 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13162 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/tier-common.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/tier-common.c b/xlators/cluster/dht/src/tier-common.c
index 845750dfdd6..d8ea95ee579 100644
--- a/xlators/cluster/dht/src/tier-common.c
+++ b/xlators/cluster/dht/src/tier-common.c
@@ -140,6 +140,7 @@ tier_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *cached_subvol = NULL;
dht_conf_t *conf = NULL;
int ret = -1;
+ unsigned char *gfid = NULL;
local = frame->local;
if (!local) {
@@ -164,9 +165,19 @@ tier_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
if (local->params) {
dict_del (local->params, conf->link_xattr_name);
dict_del (local->params, GLUSTERFS_INTERNAL_FOP_KEY);
- ret = dict_set_static_bin (local->params, TIER_LINKFILE_GFID,
- stbuf->ia_gfid, 16);
+
+ gfid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_char);
+ if (!gfid) {
+ local->op_errno = ENOMEM;
+ op_errno = ENOMEM;
+ goto err;
+ }
+
+ gf_uuid_copy (gfid, stbuf->ia_gfid);
+ ret = dict_set_dynptr (local->params, TIER_LINKFILE_GFID,
+ gfid, sizeof (uuid_t));
if (ret) {
+ GF_FREE (gfid);
gf_msg (this->name, GF_LOG_WARNING, 0,
DHT_MSG_DICT_SET_FAILED,
"Failed to set dictionary value"