summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-04-13 00:27:02 +0000
committerAnand Avati <avati@gluster.com>2011-05-30 02:08:07 -0700
commitdd55755e0ccc94f721e8ada7e50c976c9cb68c4b (patch)
treed70fe00bd97489184f0dc6faf09f0b4183aec6c0
parentdbd9dfdba36bee1a249c0e29edbfe0ded59e8c2d (diff)
rpc-clnt: consider the (re-)configured port for only one connect() call
this way, if remote_port is set due to queryport, that can fall back to default port (or 'option remote-port' value) when it disconnects. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2709 (issues with port (re-)configuration in client protocol) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2709
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c16
-rw-r--r--rpc/rpc-transport/socket/src/socket.c3
-rw-r--r--xlators/protocol/client/src/client-handshake.c9
3 files changed, 16 insertions, 12 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 732a89062..a44952487 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -393,6 +393,14 @@ rpc_clnt_reconnect (void *trans_ptr)
gf_log (trans->name, GF_LOG_TRACE,
"attempting reconnect");
ret = rpc_transport_connect (trans, conn->config.remote_port);
+ /* Every time there is a disconnection, processes
+ should try to connect to 'glusterd' (ie, default
+ port) or whichever port given as 'option remote-port'
+ in volume file. */
+ /* Below code makes sure the (re-)configured port lasts
+ for just one successful attempt */
+ if (!ret)
+ conn->config.remote_port = 0;
conn->reconnect =
gf_timer_call_after (clnt->ctx, tv,
@@ -1359,8 +1367,12 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
pthread_mutex_lock (&conn->lock);
{
if (conn->connected == 0) {
- rpc_transport_connect (conn->trans,
- conn->config.remote_port);
+ ret = rpc_transport_connect (conn->trans,
+ conn->config.remote_port);
+ /* Below code makes sure the (re-)configured port lasts
+ for just one successful connect attempt */
+ if (!ret)
+ conn->config.remote_port = 0;
}
ret = -1;
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 5b7d57b3d..47cdc1b9d 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -1971,7 +1971,8 @@ socket_connect (rpc_transport_t *this, int port)
if (sock != -1) {
gf_log_callingfn (this->name, GF_LOG_TRACE,
"connect () called on transport already connected");
- ret = 0;
+ errno = EINPROGRESS;
+ ret = -1;
goto err;
}
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index dc8276c79..9489e764f 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -958,9 +958,6 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
clnt_conf_t *conf = NULL;
dict_t *options = NULL;
- struct rpc_clnt_config config = {0, };
-
-
options = this->options;
conf = this->private;
@@ -1041,12 +1038,6 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
NULL, 0, NULL);
fail:
-
- if (ret) {
- config.remote_port = -1;
- rpc_clnt_reconfig (conf->rpc, &config);
- }
-
if (req.dict.dict_val)
GF_FREE (req.dict.dict_val);