17b94a
From 73cef29731c0d7b8b4f3b880c032dc232b8fcc31 Mon Sep 17 00:00:00 2001
17b94a
From: Mohit Agrawal <moagrawa@redhat.com>
17b94a
Date: Thu, 4 Jun 2020 16:06:44 +0530
17b94a
Subject: [PATCH 397/449] mgmt/brick-mux: Avoid sending two response when
17b94a
 attach is failed.
17b94a
17b94a
We were sending two response back to glusterd when an attach is
17b94a
failed. One from the handler function glusterfs_handle_attach and
17b94a
another from rpcsvc_check_and_reply_error. It was causing problems
17b94a
like ref leaks, transport disconnect etc.
17b94a
17b94a
> Change-Id: I3bb5b59959530760b568d52becb519499b3dcd2b
17b94a
> updates: bz#1785143
17b94a
> Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
17b94a
> (Cherry pick from commit 42f484dcecd9942611396d9bd2ad3a39019b0e1f)
17b94a
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/23906/)
17b94a
17b94a
Change-Id: I3bb5b59959530760b568d52becb519499b3dcd2b
17b94a
BUG: 1776901
17b94a
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/202346
17b94a
Reviewed-by: Sanju Rakonde <srakonde@redhat.com>
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
17b94a
---
17b94a
 glusterfsd/src/glusterfsd-mgmt.c | 10 +++++++++-
17b94a
 1 file changed, 9 insertions(+), 1 deletion(-)
17b94a
17b94a
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
17b94a
index 15acc10..61d1b21 100644
17b94a
--- a/glusterfsd/src/glusterfsd-mgmt.c
17b94a
+++ b/glusterfsd/src/glusterfsd-mgmt.c
17b94a
@@ -954,7 +954,15 @@ glusterfs_handle_attach(rpcsvc_request_t *req)
17b94a
             ret = -1;
17b94a
         }
17b94a
 
17b94a
-        glusterfs_translator_info_response_send(req, ret, NULL, NULL);
17b94a
+        ret = glusterfs_translator_info_response_send(req, ret, NULL, NULL);
17b94a
+        if (ret) {
17b94a
+            /* Response sent back to glusterd, req is already destroyed. So
17b94a
+             * resetting the ret to 0. Otherwise another response will be
17b94a
+             * send from rpcsvc_check_and_reply_error. Which will lead to
17b94a
+             * double resource leak.
17b94a
+             */
17b94a
+            ret = 0;
17b94a
+        }
17b94a
 
17b94a
     out:
17b94a
         UNLOCK(&ctx->volfile_lock);
17b94a
-- 
17b94a
1.8.3.1
17b94a