summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2013-02-08 17:20:05 +0530
committerAnand Avati <avati@redhat.com>2013-02-16 22:32:22 -0800
commit5b8cb263756a9d2beb5e70dca0b652286c7e6b67 (patch)
tree321a18df24196d022527ffb22397289dcbcc4a51 /xlators/mgmt/glusterd/src
parent86854a544e5bcc05bf6a57b7b622c48ddafc79b5 (diff)
glusterd: Made volume-heal use synctask framework.
Change-Id: Ic6659335f18a3befcf9b8b3ca067883a2c889d03 BUG: 852147 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/4493 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c6
5 files changed, 21 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 3c51879d921..f39de3116df 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -4368,7 +4368,8 @@ out:
static int
glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct list_head *selected,
+ dict_t *rsp_dict)
{
int ret = -1;
char *volname = NULL;
@@ -4379,7 +4380,6 @@ glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr,
glusterd_pending_node_t *pending_node = NULL;
gf_xl_afr_op_t heal_op = GF_AFR_OP_INVALID;
int rxlator_count = 0;
- dict_t *op_ctx = NULL;
this = THIS;
GF_ASSERT (this);
@@ -4412,9 +4412,13 @@ glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr,
if (!glusterd_is_nodesvc_online ("glustershd") &&
(heal_op == GF_AFR_OP_INDEX_SUMMARY)) {
- op_ctx = glusterd_op_get_ctx ();
+ if (!rsp_dict) {
+ gf_log (this->name, GF_LOG_ERROR, "Received empty "
+ "ctx.");
+ goto out;
+ }
- ret = fill_shd_status_for_local_bricks (op_ctx, volinfo);
+ ret = fill_shd_status_for_local_bricks (rsp_dict, volinfo);
if (ret)
gf_log (this->name, GF_LOG_ERROR, "Unable to fill the shd"
" status for the local bricks");
@@ -4764,7 +4768,7 @@ out:
int32_t
glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct list_head *selected, dict_t *rsp_dict)
{
int ret = 0;
@@ -4791,7 +4795,7 @@ glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr,
case GD_OP_HEAL_VOLUME:
ret = glusterd_bricks_select_heal_volume (dict, op_errstr,
- selected);
+ selected, rsp_dict);
break;
case GD_OP_STATUS_VOLUME:
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 21493bbd9da..df8b8c1410e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -234,7 +234,7 @@ char*
glusterd_op_sm_event_name_get (int event);
int32_t
glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr,
- struct list_head *selected);
+ struct list_head *selected, dict_t *rsp_dict);
int
glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickinfo,
gd1_mgmt_brick_op_req **req, dict_t *dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index c0de195bde1..1249728576f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1403,7 +1403,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
GF_ASSERT (req_ctx);
INIT_LIST_HEAD (&opinfo.pending_bricks);
ret = glusterd_op_bricks_select (req_ctx->op, req_ctx->dict, &op_errstr,
- &opinfo.pending_bricks);
+ &opinfo.pending_bricks, NULL);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to select bricks "
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 7aa9ea9ff38..37839a9e38c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -754,8 +754,15 @@ stage_done:
}
/*brick op */
+ rsp_dict = dict_new ();
+ if (!rsp_dict) {
+ ret = -1;
+ goto out;
+ }
+
INIT_LIST_HEAD (&selected);
- ret = glusterd_op_bricks_select (op, req_dict, &op_errstr, &selected);
+ ret = glusterd_op_bricks_select (op, req_dict, &op_errstr,
+ &selected, rsp_dict);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "%s",
(op_errstr)? op_errstr: "Brick op failed. Check "
@@ -791,12 +798,6 @@ stage_done:
brick_count);
/* commit op */
- rsp_dict = dict_new ();
- if (!rsp_dict) {
- ret = -1;
- goto out;
- }
-
ret = glusterd_op_commit_perform (op, req_dict, &op_errstr, rsp_dict);
if (ret) {
hostname = "localhost";
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index fb1832f0d47..ac8925e5416 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -461,13 +461,9 @@ glusterd_handle_cli_heal_volume (rpcsvc_request_t *req)
if (ret)
goto out;
- ret = glusterd_op_begin (req, GD_OP_HEAL_VOLUME, dict,
- op_errstr, sizeof (op_errstr));
+ ret = glusterd_op_begin_synctask (req, GD_OP_HEAL_VOLUME, dict);
out:
- glusterd_friend_sm ();
- glusterd_op_sm ();
-
if (ret) {
if (op_errstr[0] == '\0')
snprintf (op_errstr, sizeof (op_errstr),