summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2019-12-18 13:16:39 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2019-12-31 13:35:10 +0000
commit42f484dcecd9942611396d9bd2ad3a39019b0e1f (patch)
tree21bcebb5fe1c3881fb7b287566366c690068addf /glusterfsd
parent745f6534c514010cc69e2306e1621e9d14ff5dba (diff)
mgmt/brick-mux: Avoid sending two response when attach is failed.
We were sending two response back to glusterd when an attach is failed. One from the handler function glusterfs_handle_attach and another from rpcsvc_check_and_reply_error. It was causing problems like ref leaks, transport disconnect etc. Change-Id: I3bb5b59959530760b568d52becb519499b3dcd2b updates: bz#1785143 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index dc487e8afcc..2b97dc91165 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -992,7 +992,15 @@ glusterfs_handle_attach(rpcsvc_request_t *req)
if (ret) {
ret = -1;
}
- glusterfs_translator_info_response_send(req, ret, NULL, NULL);
+ ret = glusterfs_translator_info_response_send(req, ret, NULL, NULL);
+ if (ret) {
+ /* Response sent back to glusterd, req is already destroyed. So
+ * resetting the ret to 0. Otherwise another response will be
+ * send from rpcsvc_check_and_reply_error. Which will lead to
+ * double resource leak.
+ */
+ ret = 0;
+ }
unlock:
UNLOCK(&ctx->volfile_lock);
}