summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c48
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h3
3 files changed, 15 insertions, 38 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).
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index aba37c7fd9b..8cbff80f7de 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6708,7 +6708,7 @@ glusterd_volume_defrag_restart (glusterd_volinfo_t *volinfo, char *op_errstr,
glusterd_handle_defrag_start (volinfo, op_errstr, len, cmd,
cbk, volinfo->rebal.op);
} else {
- glusterd_rebalance_rpc_create (volinfo, priv, cmd);
+ glusterd_rebalance_rpc_create (volinfo);
}
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index d1c03d37b3b..e1e9e591f39 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -725,8 +725,7 @@ int glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
size_t len, int cmd, defrag_cbk_fn_t cbk,
glusterd_op_t op);
int
-glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,
- glusterd_conf_t *priv, int cmd);
+glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo);
int glusterd_handle_cli_heal_volume (rpcsvc_request_t *req);