3604df
From b6c986e34cecfdf4bbcdfae4deb3eb4c331490a6 Mon Sep 17 00:00:00 2001
3604df
From: Mateusz Slupny <mateusz.slupny@appeartv.com>
3604df
Date: Tue, 29 Nov 2016 12:01:48 +0100
3604df
Subject: [PATCH 215/227] selfheal: fix memory leak on client side healing
3604df
 queue
3604df
3604df
Backport of http://review.gluster.org/#/c/15968/
3604df
3604df
When the client side background heal queue is full, we were not freeing
3604df
up the frames that we created for queuing in the heal.
3604df
3604df
Change-Id: Ic3daaf74f077108c5cd2105d99872d7b87a3eb63
3604df
BUG: 1400395
3604df
Signed-off-by: Mateusz Slupny <mateusz.slupny@appeartv.com>
3604df
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/91823
3604df
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
3604df
---
3604df
 xlators/cluster/afr/src/afr-common.c           | 5 ++++-
3604df
 xlators/cluster/afr/src/afr-self-heal-common.c | 4 +++-
3604df
 xlators/cluster/afr/src/afr-self-heal.h        | 2 +-
3604df
 3 files changed, 8 insertions(+), 3 deletions(-)
3604df
3604df
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
3604df
index 1d1882f..8098c1c 100644
3604df
--- a/xlators/cluster/afr/src/afr-common.c
3604df
+++ b/xlators/cluster/afr/src/afr-common.c
3604df
@@ -1166,7 +1166,10 @@ afr_inode_refresh_done (call_frame_t *frame, xlator_t *this)
3604df
                 }
3604df
                 heal_local->refreshinode = inode_ref (local->refreshinode);
3604df
                 heal_local->heal_frame = heal_frame;
3604df
-                afr_throttled_selfheal (heal_frame, this);
3604df
+                if (!afr_throttled_selfheal (heal_frame, this)) {
3604df
+                        AFR_STACK_DESTROY (heal_frame);
3604df
+                        goto refresh_done;
3604df
+                }
3604df
         }
3604df
 
3604df
 refresh_done:
3604df
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
3604df
index 8f8b76c..74696b5 100644
3604df
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
3604df
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
3604df
@@ -2097,7 +2097,7 @@ afr_heal_synctask (xlator_t *this, afr_local_t *local)
3604df
                 afr_refresh_heal_done (ret, heal_frame, heal_frame);
3604df
 }
3604df
 
3604df
-void
3604df
+gf_boolean_t
3604df
 afr_throttled_selfheal (call_frame_t *frame, xlator_t *this)
3604df
 {
3604df
         gf_boolean_t can_heal = _gf_true;
3604df
@@ -2125,6 +2125,8 @@ afr_throttled_selfheal (call_frame_t *frame, xlator_t *this)
3604df
                         gf_msg_debug (this->name, 0, "Max number of heals are "
3604df
                                       "pending, background self-heal rejected.");
3604df
         }
3604df
+
3604df
+        return can_heal;
3604df
 }
3604df
 
3604df
 int
3604df
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
3604df
index 80b7f3a..500227a 100644
3604df
--- a/xlators/cluster/afr/src/afr-self-heal.h
3604df
+++ b/xlators/cluster/afr/src/afr-self-heal.h
3604df
@@ -85,7 +85,7 @@
3604df
 int
3604df
 afr_selfheal (xlator_t *this, uuid_t gfid);
3604df
 
3604df
-void
3604df
+gf_boolean_t
3604df
 afr_throttled_selfheal (call_frame_t *frame, xlator_t *this);
3604df
 
3604df
 int
3604df
-- 
3604df
2.9.3
3604df