diff options
author | Mohit Agrawal <moagrawa@redhat.com> | 2018-02-10 12:25:15 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-02-27 07:11:15 +0000 |
commit | 7c3cc485054e4ede1efb358552135b432fb7047a (patch) | |
tree | 5657500860f795b7c895bce14069545d8ba463e2 /xlators/features/marker/src/marker.c | |
parent | 430bff7dc330eec9447423e95f2cae49744a79c3 (diff) |
glusterfsd: Memleak in glusterfsd process while brick mux is on
Problem: At the time of stopping the volume while brick multiplex is
enabled memory is not cleanup from all server side xlators.
Solution: To cleanup memory for all server side xlators call fini
in glusterfs_handle_terminate after send GF_EVENT_CLEANUP
notification to top xlator.
BUG: 1544090
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Note: Run all test-cases in separate build (https://review.gluster.org/19574)
with same patch after enable brick mux forcefully, all test cases are
passed.
Change-Id: Ia10dc7f2605aa50f2b90b3fe4eb380ba9299e2fc
Diffstat (limited to 'xlators/features/marker/src/marker.c')
-rw-r--r-- | xlators/features/marker/src/marker.c | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index cb8f8356259..36cfb34f069 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -3193,9 +3193,9 @@ mem_acct_init (xlator_t *this) int32_t init_xtime_priv (xlator_t *this, dict_t *options) { - data_t *data = NULL; int32_t ret = -1; marker_conf_t *priv = NULL; + char *tmp_opt = NULL; GF_VALIDATE_OR_GOTO ("marker", this, out); GF_VALIDATE_OR_GOTO (this->name, options, out); @@ -3203,29 +3203,11 @@ init_xtime_priv (xlator_t *this, dict_t *options) priv = this->private; - if((data = dict_get (options, VOLUME_UUID)) != NULL) { - priv->volume_uuid = data->data; + ret = dict_get_str (options, "volume-uuid", &tmp_opt); - ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); - if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, - "invalid volume uuid %s", priv->volume_uuid); - goto out; - } - - ret = gf_asprintf (& (priv->marker_xattr), "%s.%s.%s", - MARKER_XATTR_PREFIX, priv->volume_uuid, - XTIME); - - if (ret == -1){ - priv->marker_xattr = NULL; - goto out; - } - - gf_log (this->name, GF_LOG_DEBUG, - "volume-uuid = %s", priv->volume_uuid); - } else { + if (ret) { priv->volume_uuid = NULL; + tmp_opt = ""; gf_log (this->name, GF_LOG_ERROR, "please specify the volume-uuid" @@ -3233,16 +3215,32 @@ init_xtime_priv (xlator_t *this, dict_t *options) return -1; } + gf_asprintf (&priv->volume_uuid, "%s", tmp_opt); - if ((data = dict_get (options, TIMESTAMP_FILE)) != NULL) { - priv->timestamp_file = data->data; + ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); - gf_log (this->name, GF_LOG_DEBUG, - "the timestamp-file is = %s", - priv->timestamp_file); + if (ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "invalid volume uuid %s", priv->volume_uuid); + goto out; + } - } else { + ret = gf_asprintf (&(priv->marker_xattr), "%s.%s.%s", + MARKER_XATTR_PREFIX, priv->volume_uuid, + XTIME); + + if (ret == -1) { + priv->marker_xattr = NULL; + goto out; + } + + gf_log (this->name, GF_LOG_DEBUG, + "volume-uuid = %s", priv->volume_uuid); + + ret = dict_get_str (options, "timestamp-file", &tmp_opt); + if (ret) { priv->timestamp_file = NULL; + tmp_opt = ""; gf_log (this->name, GF_LOG_ERROR, "please specify the timestamp-file" @@ -3251,6 +3249,15 @@ init_xtime_priv (xlator_t *this, dict_t *options) goto out; } + ret = gf_asprintf (&priv->timestamp_file, "%s", tmp_opt); + if (ret == -1) { + priv->timestamp_file = NULL; + goto out; + } + + gf_log (this->name, GF_LOG_DEBUG, + "the timestamp-file is = %s", priv->timestamp_file); + ret = 0; out: return ret; @@ -3292,6 +3299,12 @@ marker_priv_cleanup (xlator_t *this) LOCK_DESTROY (&priv->lock); GF_FREE (priv); + + if (this->local_pool) { + mem_pool_destroy (this->local_pool); + this->local_pool = NULL; + } + out: return; } |