a3470f
From 8879d72884396de4ae2ff41649de5f2d916d272b Mon Sep 17 00:00:00 2001
a3470f
From: Milind Changire <mchangir@redhat.com>
a3470f
Date: Fri, 13 Apr 2018 10:53:46 +0530
a3470f
Subject: [PATCH 257/260] rpc: rearm listener socket early
a3470f
a3470f
Problem:
a3470f
On node reboot, when glusterd starts volumes, a setup with a large
a3470f
number of bricks might cause SYN Flooding and connections to be dropped
a3470f
if the connections are not accepted quickly enough.
a3470f
a3470f
Solution:
a3470f
accept() the connection and rearm the listener socket early to receive
a3470f
more connection requests as soon as possible.
a3470f
a3470f
mainline:
a3470f
> Reviewed-on: https://review.gluster.org/19833
a3470f
> Change-Id: Ibed421e50284c3f7a8fcdb4de7ac86cf53d4b74e
a3470f
> fixes: bz#1564600
a3470f
> Signed-off-by: Milind Changire <mchangir@redhat.com>
a3470f
a3470f
Change-Id: I4bf45b8a12f738ed9b398246e22dfd29e6b1010c
a3470f
BUG: 1563804
a3470f
Signed-off-by: Milind Changire <mchangir@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/135513
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 rpc/rpc-transport/socket/src/socket.c | 5 +++--
a3470f
 1 file changed, 3 insertions(+), 2 deletions(-)
a3470f
a3470f
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
a3470f
index a6be911..b98efdc 100644
a3470f
--- a/rpc/rpc-transport/socket/src/socket.c
a3470f
+++ b/rpc/rpc-transport/socket/src/socket.c
a3470f
@@ -2746,6 +2746,9 @@ socket_server_event_handler (int fd, int idx, int gen, void *data,
a3470f
         if (poll_in) {
a3470f
                 new_sock = accept (priv->sock, SA (&new_sockaddr), &addrlen);
a3470f
 
a3470f
+                if (ctx)
a3470f
+                        event_handled (ctx->event_pool, fd, idx, gen);
a3470f
+
a3470f
                 if (new_sock == -1) {
a3470f
                         gf_log (this->name, GF_LOG_WARNING,
a3470f
                                 "accept on %d failed (%s)",
a3470f
@@ -2968,8 +2971,6 @@ socket_server_event_handler (int fd, int idx, int gen, void *data,
a3470f
                 }
a3470f
         }
a3470f
 out:
a3470f
-        event_handled (ctx->event_pool, fd, idx, gen);
a3470f
-
a3470f
         if (cname && (cname != this->ssl_name)) {
a3470f
                 GF_FREE(cname);
a3470f
         }
a3470f
-- 
a3470f
1.8.3.1
a3470f