e7a346
From 9b001e38b21d433580d55e68225f2cd5af058dbf Mon Sep 17 00:00:00 2001
e7a346
From: Gaurav Yadav <gyadav@redhat.com>
e7a346
Date: Thu, 1 Mar 2018 14:44:34 +0530
e7a346
Subject: [PATCH 204/212] glusterd : memory leak in mgmt_v3 lock functionality
e7a346
e7a346
In order to take care of stale lock issue, a timer was intrduced
e7a346
in mgmt_v3 lock. This timer is not freeing the memory due to
e7a346
which this leak got introduced
e7a346
e7a346
With this fix now memory cleanup in locking is handled properly
e7a346
e7a346
>upstream patch: https://review.gluster.org/#/c/19651/
e7a346
>                https://review.gluster.org/#/c/19723/
e7a346
e7a346
>Change-Id: I2e1ce3ebba3520f7660321f3d97554080e4e22f4
e7a346
>BUG: 1550339
e7a346
>Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
e7a346
e7a346
Change-Id: I2e1ce3ebba3520f7660321f3d97554080e4e22f4
e7a346
BUG: 1529451
e7a346
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/134218
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
e7a346
---
e7a346
 xlators/mgmt/glusterd/src/glusterd-locks.c | 8 +++++++-
e7a346
 1 file changed, 7 insertions(+), 1 deletion(-)
e7a346
e7a346
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
e7a346
index bd73b37..a19d688 100644
e7a346
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
e7a346
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
e7a346
@@ -719,6 +719,7 @@ gd_mgmt_v3_unlock_timer_cbk (void *data)
e7a346
         int32_t                         ret                 = -1;
e7a346
         glusterfs_ctx_t                *mgmt_lock_timer_ctx = NULL;
e7a346
         xlator_t                       *mgmt_lock_timer_xl  = NULL;
e7a346
+        gf_timer_t                     *timer               = NULL;
e7a346
 
e7a346
         this = THIS;
e7a346
         GF_VALIDATE_OR_GOTO ("glusterd", this, out);
e7a346
@@ -766,9 +767,10 @@ out:
e7a346
                 GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx,
e7a346
                                      ret_function);
e7a346
 
e7a346
+                timer = mgmt_lock_timer->timer;
e7a346
+                GF_FREE (timer->data);
e7a346
                 gf_timer_call_cancel (mgmt_lock_timer_ctx,
e7a346
                                       mgmt_lock_timer->timer);
e7a346
-                GF_FREE(key);
e7a346
                 dict_del (conf->mgmt_v3_lock_timer, bt_key);
e7a346
                 mgmt_lock_timer->timer = NULL;
e7a346
         }
e7a346
@@ -791,6 +793,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
e7a346
         xlator_t                        *this               = NULL;
e7a346
         glusterfs_ctx_t                *mgmt_lock_timer_ctx = NULL;
e7a346
         xlator_t                       *mgmt_lock_timer_xl  = NULL;
e7a346
+        gf_timer_t                     *timer               = NULL;
e7a346
 
e7a346
         this = THIS;
e7a346
         GF_ASSERT (this);
e7a346
@@ -893,6 +896,9 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
e7a346
                 mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
e7a346
                 GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx, out);
e7a346
                 ret = 0;
e7a346
+
e7a346
+                timer = mgmt_lock_timer->timer;
e7a346
+                GF_FREE (timer->data);
e7a346
                 gf_timer_call_cancel (mgmt_lock_timer_ctx,
e7a346
                                       mgmt_lock_timer->timer);
e7a346
                 dict_del (priv->mgmt_v3_lock_timer, key_dup);
e7a346
-- 
e7a346
1.8.3.1
e7a346