summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@dhcp35-131.lab.eng.blr.redhat.com>2016-07-05 14:33:15 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-08-01 09:22:04 -0700
commit07b95cf8104da42d783d053d0fbb8497399f7d00 (patch)
tree2b200f9ad41559774a9b8afe60aeefe7180736f3
parent6a29c76ae629d17d276c96b2e50f0b43e5fdf309 (diff)
glusterd: Fix memory leak in glusterd (un)lock RPCs
Problem: At the time of execute "gluster volume profile <vol> info" command It does have memory leak in glusterd. Solution: Modify the code to prevent memory leak in glusterd. Fix : 1) Unref dict and free dict_val buffer in glusterd_mgmt_v3_lock_peer and glusterd_mgmt_v3_unlock_peers. Test : To verify the patch run below loop to generate io traffic for (( i=0 ; i<=1000000 ; i++ )); do echo "hi Start Line " > file$i; cat file$i >> /dev/null; done To verify the improvement in memory leak specific to glusterd run below command cnt=0;while [ $cnt -le 1000 ]; do pmap -x <glusterd-pid> | grep total; gluster volume profile distributed info > /dev/null; cnt=`expr $cnt + 1`; done After apply this patch it will reduce leak significantly. Change-Id: I52a0ca47adb20bfe4b1848a11df23e5e37c5cea9 BUG: 1352854 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Reviewed-on: http://review.gluster.org/14862 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 73646ec4bfc..890ccf06cdc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1832,6 +1832,10 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_req);
out:
gf_msg_debug (this->name, 0, "Returning %d", ret);
+ if (dict)
+ dict_unref (dict);
+ if (req.dict.dict_val)
+ GF_FREE (req.dict.dict_val);
return ret;
}
@@ -1909,6 +1913,11 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this,
xdr_gd1_mgmt_v3_unlock_req);
out:
gf_msg_debug (this->name, 0, "Returning %d", ret);
+ if (dict)
+ dict_unref(dict);
+
+ if (req.dict.dict_val)
+ GF_FREE (req.dict.dict_val);
return ret;
}