From 6964640a977cb10c0c95a94e03c229918fa6eca8 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Fri, 6 Apr 2018 23:19:07 +0530 Subject: rpc: rearm listener socket early Problem: On node reboot, when glusterd starts volumes, a setup with a large number of bricks might cause SYN Flooding and connections to be dropped if the connections are not accepted quickly enough. Solution: accept() the connection and rearm the listener socket early to receive more connection requests as soon as possible. Change-Id: Ibed421e50284c3f7a8fcdb4de7ac86cf53d4b74e fixes: bz#1564600 Signed-off-by: Milind Changire --- rpc/rpc-transport/socket/src/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rpc/rpc-transport') diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 256454a9515..a000b26e515 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -2893,6 +2893,9 @@ socket_server_event_handler (int fd, int idx, int gen, void *data, if (poll_in) { new_sock = accept (priv->sock, SA (&new_sockaddr), &addrlen); + if (ctx) + event_handled (ctx->event_pool, fd, idx, gen); + if (new_sock == -1) { gf_log (this->name, GF_LOG_WARNING, "accept on %d failed (%s)", @@ -3115,9 +3118,6 @@ socket_server_event_handler (int fd, int idx, int gen, void *data, } } out: - if (ctx) - event_handled (ctx->event_pool, fd, idx, gen); - if (cname && (cname != this->ssl_name)) { GF_FREE(cname); } -- cgit