summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-08-17 13:12:33 +0530
committerVijay Bellur <vijay@gluster.com>2012-08-17 13:46:19 +0530
commit9c0cbe6955f702b1ca27e0f48e309382f5d59186 (patch)
treefcb2980cca180b2ce6ae335247bddd3a323b2b97
parent804f8fc459db25f395acf7741e20cda8b35a9353 (diff)
rpc: Reduce frame-timeout for glusterd connections
Reduce frame-timeout for glusterd connections from 30mins to 10 mins. 30mins is too long when compared to cli timeout of 2mins. Changing to 10mins reduces the disparity between cli and glusterd. Also, fix glusterfs_submit_reply() so that a reply is sent even if serialize failed. BUG: 843003 Change-Id: Ie8d5ec16fbbb54318a5935a47065e66fd3338b87 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/3812 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c5
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c9
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
6 files changed, 58 insertions, 13 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index d8582aa7013..08aad9dc6e7 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -141,11 +141,10 @@ glusterfs_submit_reply (rpcsvc_request_t *req, void *arg,
iob = glusterfs_serialize_reply (req, arg, &rsp, xdrproc);
if (!iob) {
gf_log_callingfn (THIS->name, GF_LOG_ERROR, "Failed to serialize reply");
- goto out;
+ } else {
+ iobref_add (iobref, iob);
}
- iobref_add (iobref, iob);
-
ret = rpcsvc_submit_generic (req, &rsp, 1, payload, payloadcount,
iobref);
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index f55a58778bf..f8a75f6d385 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1681,7 +1681,8 @@ rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config)
}
int
-rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath)
+rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath,
+ int frame_timeout)
{
dict_t *dict = NULL;
char *fpath = NULL;
@@ -1720,6 +1721,12 @@ rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath)
if (ret)
goto out;
+ if (frame_timeout > 0) {
+ ret = dict_set_int32 (dict, "frame-timeout", frame_timeout);
+ if (ret)
+ goto out;
+ }
+
*options = dict;
out:
if (ret) {
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index e7335e38839..ca3c1d027a2 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -235,7 +235,8 @@ int rpcclnt_cbk_program_register (struct rpc_clnt *svc,
rpcclnt_cb_program_t *program);
int
-rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath);
+rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath,
+ int frame_timeout);
void
rpc_clnt_disable (struct rpc_clnt *rpc);
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 0e3c211b3f9..41ae4393903 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2108,8 +2108,8 @@ glusterd_transport_keepalive_options_get (int *interval, int *time)
}
int
-glusterd_transport_inet_keepalive_options_build (dict_t **options,
- const char *hostname, int port)
+glusterd_transport_inet_options_build (dict_t **options, const char *hostname,
+ int port)
{
dict_t *dict = NULL;
int32_t interval = -1;
@@ -2121,10 +2121,25 @@ glusterd_transport_inet_keepalive_options_build (dict_t **options,
if (!port)
port = GLUSTERD_DEFAULT_PORT;
+
+ /* Build default transport options */
ret = rpc_transport_inet_options_build (&dict, hostname, port);
if (ret)
goto out;
+ /* Set frame-timeout to 10mins. Default timeout of 30 mins is too long
+ * when compared to 2 mins for cli timeout. This ensures users don't
+ * wait too long after cli timesout before being able to resume normal
+ * operations
+ */
+ ret = dict_set_int32 (dict, "frame-timeout", 600);
+ if (ret) {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "Failed to set frame-timeout");
+ goto out;
+ }
+
+ /* Set keepalive options */
glusterd_transport_keepalive_options_get (&interval, &time);
if ((interval > 0) || (time > 0))
@@ -2170,8 +2185,7 @@ glusterd_friend_add (const char *hoststr, int port,
peerctx->peerinfo = *friend;
- ret = glusterd_transport_inet_keepalive_options_build (&options,
- hoststr, port);
+ ret = glusterd_transport_inet_options_build (&options, hoststr, port);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 010ff599cf9..b63f4643bee 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -326,7 +326,13 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
}
sleep (5);
- ret = rpc_clnt_transport_unix_options_build (&options, sockfile);
+
+ /* Setting frame-timeout to 10mins (600seconds).
+ * Unix domain sockets ensures that the connection is reliable. The
+ * default timeout of 30mins used for unreliable network connections is
+ * too long for unix domain socket connections.
+ */
+ ret = rpc_clnt_transport_unix_options_build (&options, sockfile, 600);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");
goto out;
@@ -370,7 +376,13 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,
LOCK_INIT (&defrag->lock);
GLUSTERD_GET_DEFRAG_SOCK_FILE (sockfile, volinfo, priv);
- ret = rpc_clnt_transport_unix_options_build (&options, sockfile);
+
+ /* Setting frame-timeout to 10mins (600seconds).
+ * Unix domain sockets ensures that the connection is reliable. The
+ * default timeout of 30mins used for unreliable network connections is
+ * too long for unix domain socket connections.
+ */
+ ret = rpc_clnt_transport_unix_options_build (&options, sockfile, 600);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 46a7997b763..91124583459 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1099,7 +1099,14 @@ glusterd_brick_connect (glusterd_volinfo_t *volinfo,
glusterd_set_brick_socket_filepath (volinfo, brickinfo,
socketpath,
sizeof (socketpath));
- ret = rpc_clnt_transport_unix_options_build (&options, socketpath);
+
+ /* Setting frame-timeout to 10mins (600seconds).
+ * Unix domain sockets ensures that the connection is reliable.
+ * The default timeout of 30mins used for unreliable network
+ * connections is too long for unix domain socket connections.
+ */
+ ret = rpc_clnt_transport_unix_options_build (&options,
+ socketpath, 600);
if (ret)
goto out;
ret = glusterd_rpc_create (&rpc, options,
@@ -2793,8 +2800,13 @@ glusterd_nodesvc_connect (char *server, char *socketpath) {
rpc = glusterd_nodesvc_get_rpc (server);
if (rpc == NULL) {
+ /* Setting frame-timeout to 10mins (600seconds).
+ * Unix domain sockets ensures that the connection is reliable.
+ * The default timeout of 30mins used for unreliable network
+ * connections is too long for unix domain socket connections.
+ */
ret = rpc_clnt_transport_unix_options_build (&options,
- socketpath);
+ socketpath, 600);
if (ret)
goto out;
ret = glusterd_rpc_create (&rpc, options,