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