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