|
|
e7a346 |
From 597826a5fa4e307a23615a03031d2df0f739652f Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
e7a346 |
Date: Tue, 20 Nov 2018 15:55:31 +0530
|
|
|
e7a346 |
Subject: [PATCH 448/450] core: Resolve memory leak at the time of graph init
|
|
|
e7a346 |
|
|
|
e7a346 |
Problem: Memory leak when graph init fails as during volfile
|
|
|
e7a346 |
exchange between brick and glusterd
|
|
|
e7a346 |
|
|
|
e7a346 |
Solution: Fix the error code path in glusterfs_graph_init
|
|
|
e7a346 |
|
|
|
e7a346 |
> Change-Id: If62bee61283fccb7fd60abc6ea217cfac12358fa
|
|
|
e7a346 |
> fixes: bz#1651431
|
|
|
e7a346 |
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
e7a346 |
> (cherry pick from commit 751b14f2bfd40e08ad395ccd98c6eb0a41ac4e91)
|
|
|
e7a346 |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/21658/)
|
|
|
e7a346 |
|
|
|
e7a346 |
Change-Id: I29fd290e71754214cc242eac0cc9461d18abec81
|
|
|
e7a346 |
BUG: 1650138
|
|
|
e7a346 |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/156358
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
glusterfsd/src/glusterfsd.c | 11 +++++++----
|
|
|
e7a346 |
xlators/mgmt/glusterd/src/glusterd.c | 4 ----
|
|
|
e7a346 |
2 files changed, 7 insertions(+), 8 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
|
|
|
e7a346 |
index 6b7adc4..262a0c1 100644
|
|
|
e7a346 |
--- a/glusterfsd/src/glusterfsd.c
|
|
|
e7a346 |
+++ b/glusterfsd/src/glusterfsd.c
|
|
|
e7a346 |
@@ -2383,11 +2383,14 @@ out:
|
|
|
e7a346 |
if (fp)
|
|
|
e7a346 |
fclose (fp);
|
|
|
e7a346 |
|
|
|
e7a346 |
- if (ret && !ctx->active) {
|
|
|
e7a346 |
- glusterfs_graph_destroy (graph);
|
|
|
e7a346 |
+ if (ret) {
|
|
|
e7a346 |
+ if (graph && (ctx && (ctx->active != graph)))
|
|
|
e7a346 |
+ glusterfs_graph_destroy (graph);
|
|
|
e7a346 |
/* there is some error in setting up the first graph itself */
|
|
|
e7a346 |
- emancipate (ctx, ret);
|
|
|
e7a346 |
- cleanup_and_exit (ret);
|
|
|
e7a346 |
+ if (!ctx->active) {
|
|
|
e7a346 |
+ emancipate (ctx, ret);
|
|
|
e7a346 |
+ cleanup_and_exit (ret);
|
|
|
e7a346 |
+ }
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
return ret;
|
|
|
e7a346 |
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
e7a346 |
index 076019f..ca17526 100644
|
|
|
e7a346 |
--- a/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
e7a346 |
+++ b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
e7a346 |
@@ -1120,10 +1120,6 @@ glusterd_init_uds_listener (xlator_t *this)
|
|
|
e7a346 |
strncpy (sockfile, sock_data->data, UNIX_PATH_MAX);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- options = dict_new ();
|
|
|
e7a346 |
- if (!options)
|
|
|
e7a346 |
- goto out;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
ret = rpcsvc_transport_unix_options_build (&options, sockfile);
|
|
|
e7a346 |
if (ret)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|