diff options
author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-12-04 15:55:01 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-12-05 16:44:06 -0800 |
commit | b58810f5df92873ddd658efaae1caddddce96ae2 (patch) | |
tree | ce15ebe464001ac1532a60427648792541b422f5 /xlators | |
parent | 9a9f73e411e96ae6fef24bb0475e7462c0a19d38 (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')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 48 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 3 |
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 1b6ee293a..7911c3d21 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 aba37c7fd..8cbff80f7 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 d1c03d37b..e1e9e591f 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); |