summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2015-01-08 09:43:50 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-01-15 00:06:34 -0800
commitc4561b6fd90c52667eebec9eecf974b4c0786382 (patch)
treee9df8ca31bd71051adfddde44cc7fec544675469
parente9c90da38e1b6fb7fc4e0d5d1e987c510d1c17d6 (diff)
rpc: initialise transport's list on creation
Initialising the transport's list, meant to hold clients connected to it, on the first connection event is prone to race, especially with the introduction of multi-threaded event layer. BUG: 1181203 Change-Id: I6a20686a2012c1f49a279cc9cd55a03b8c7615fc Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/9413 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c1
-rw-r--r--xlators/protocol/server/src/server.c1
3 files changed, 2 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index cf7f903056a..266d07e99ed 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -334,6 +334,8 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
goto fail;
}
+ INIT_LIST_HEAD (&trans->list);
+
return_trans = trans;
GF_FREE (name);
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 98ac403a4c1..1efe7d08a0f 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -319,7 +319,6 @@ glusterd_rpcsvc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
switch (event) {
case RPCSVC_EVENT_ACCEPT:
{
- INIT_LIST_HEAD (&xprt->list);
pthread_mutex_lock (&priv->xprt_lock);
list_add_tail (&xprt->list, &priv->xprt_list);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 0dfe19a16b4..4cd2353f1b0 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -495,7 +495,6 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
trans->protocol_private = client->conn;
*/
- INIT_LIST_HEAD (&trans->list);
pthread_mutex_lock (&conf->mutex);
{