summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rebalance.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2013-12-04 15:55:01 +0530
committerAnand Avati <avati@redhat.com>2013-12-05 16:44:06 -0800
commitb58810f5df92873ddd658efaae1caddddce96ae2 (patch)
treece15ebe464001ac1532a60427648792541b422f5 /xlators/mgmt/glusterd/src/glusterd-rebalance.c
parent9a9f73e411e96ae6fef24bb0475e7462c0a19d38 (diff)
glusterd: create rpc obj for rebalance only if absentv3.5.0qa3
Change-Id: Iff305023577ff92a8f43f24dafcf201f86805769 BUG: 1038051 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/6424 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 1b6ee293ae3..7911c3d210d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -195,7 +195,6 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
char sockfile[PATH_MAX] = {0,};
char pidfile[PATH_MAX] = {0,};
char logfile[PATH_MAX] = {0,};
- dict_t *options = NULL;
char valgrind_logfile[PATH_MAX] = {0,};
priv = THIS->private;
@@ -286,26 +285,10 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
sleep (5);
- /* 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_transport_unix_options_build (&options, sockfile, 600);
- if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");
- goto out;
- }
-
- synclock_unlock (&priv->big_lock);
- ret = glusterd_rpc_create (&defrag->rpc, options,
- glusterd_defrag_notify, volinfo);
- synclock_lock (&priv->big_lock);
- if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "RPC create failed");
- goto out;
- }
+ ret = glusterd_rebalance_rpc_create (volinfo);
+ //FIXME: this cbk is passed as NULL in all occurrences. May be
+ //we never needed it.
if (cbk)
defrag->cbk_fn = cbk;
@@ -316,28 +299,23 @@ out:
int
-glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,
- glusterd_conf_t *priv, int cmd)
+glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo)
{
dict_t *options = NULL;
char sockfile[PATH_MAX] = {0,};
int ret = -1;
- glusterd_defrag_info_t *defrag = NULL;
+ glusterd_defrag_info_t *defrag = volinfo->rebal.defrag;
+ glusterd_conf_t *priv = THIS->private;
- if (!volinfo->rebal.defrag)
- volinfo->rebal.defrag =
- GF_CALLOC (1, sizeof (*volinfo->rebal.defrag),
- gf_gld_mt_defrag_info);
-
- if (!volinfo->rebal.defrag)
+ //rebalance process is not started
+ if (!defrag)
goto out;
- defrag = volinfo->rebal.defrag;
-
- defrag->cmd = cmd;
-
- LOCK_INIT (&defrag->lock);
-
+ //rpc obj for rebalance process already in place.
+ if (defrag->rpc) {
+ ret = 0;
+ goto out;
+ }
GLUSTERD_GET_DEFRAG_SOCK_FILE (sockfile, volinfo, priv);
/* Setting frame-timeout to 10mins (600seconds).