From 64ac145980b19ad7aa399b69d4475453f132827b Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Mon, 16 May 2016 15:15:49 +0530 Subject: rpc/socket: Close pipe on disconnection Encrypted connections create a pipe, which isn't closed when the connection disconnects. This leaks fds, and gluster eventually ends up in a situation with fd starvation which leads to operation failures. > Change-Id: I144e1f767cec8c6fc1aa46b00cd234129d2a4adc > BUG: 1336371 > Signed-off-by: Kaushal M > Reviewed-on: http://review.gluster.org/14356 > Tested-by: MOHIT AGRAWAL > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > NetBSD-regression: NetBSD Build System > Reviewed-by: Raghavendra G Change-Id: I144e1f767cec8c6fc1aa46b00cd234129d2a4adc BUG: 1336376 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/15703 Tested-by: Atin Mukherjee NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee Smoke: Gluster Build System --- rpc/rpc-transport/socket/src/socket.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 700157ea240..4244883a5db 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -2567,10 +2567,17 @@ err: __socket_teardown_connection (this); sys_close (priv->sock); priv->sock = -1; + + sys_close (priv->pipe[0]); + sys_close (priv->pipe[1]); + priv->pipe[0] = -1; + priv->pipe[1] = -1; + priv->ot_state = OT_IDLE; + pthread_mutex_unlock(&priv->lock); - rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); + rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); rpc_transport_unref (this); -- cgit