|
|
cb8e9e |
From ba7a80d22d4664bcbe420bd011ea60ee00d15ab1 Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Krishnan Parthasarathi <kparthas@redhat.com>
|
|
|
cb8e9e |
Date: Fri, 22 May 2015 00:37:58 +0530
|
|
|
cb8e9e |
Subject: [PATCH 27/57] socket: throttle only connected transport
|
|
|
cb8e9e |
|
|
|
cb8e9e |
BUG: 1203901
|
|
|
cb8e9e |
Change-Id: I2352c6661ae5aee8cf06e572ec0462b76901d46f
|
|
|
cb8e9e |
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: http://review.gluster.org/10887
|
|
|
cb8e9e |
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Reviewed-by: Shyam Ranganathan <srangana@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50386
|
|
|
cb8e9e |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
rpc/rpc-transport/socket/src/socket.c | 17 +++++++++++++++--
|
|
|
cb8e9e |
1 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
|
|
|
cb8e9e |
index 82a84dd..e30e231 100644
|
|
|
cb8e9e |
--- a/rpc/rpc-transport/socket/src/socket.c
|
|
|
cb8e9e |
+++ b/rpc/rpc-transport/socket/src/socket.c
|
|
|
cb8e9e |
@@ -3572,8 +3572,21 @@ socket_throttle (rpc_transport_t *this, gf_boolean_t onoff)
|
|
|
cb8e9e |
will never read() any more data until throttling
|
|
|
cb8e9e |
is turned off.
|
|
|
cb8e9e |
*/
|
|
|
cb8e9e |
- priv->idx = event_select_on (this->ctx->event_pool, priv->sock,
|
|
|
cb8e9e |
- priv->idx, (int) !onoff, -1);
|
|
|
cb8e9e |
+ pthread_mutex_lock (&priv->lock);
|
|
|
cb8e9e |
+ {
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ /* Throttling is useless on a disconnected transport. In fact,
|
|
|
cb8e9e |
+ * it's dangerous since priv->idx and priv->sock are set to -1
|
|
|
cb8e9e |
+ * on a disconnected transport, which breaks epoll's event to
|
|
|
cb8e9e |
+ * registered fd mapping. */
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ if (priv->connected == 1)
|
|
|
cb8e9e |
+ priv->idx = event_select_on (this->ctx->event_pool,
|
|
|
cb8e9e |
+ priv->sock,
|
|
|
cb8e9e |
+ priv->idx, (int) !onoff,
|
|
|
cb8e9e |
+ -1);
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
+ pthread_mutex_unlock (&priv->lock);
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|