diff options
author | Avra Sengupta <asengupt@redhat.com> | 2013-02-08 16:59:21 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-08 14:08:22 -0800 |
commit | e289d3db5f448695bee004da99290346fa787093 (patch) | |
tree | 30841d6d5114d85e098d584c5d5e8b74c2902073 /xlators/mgmt/glusterd/src | |
parent | e4187ac41346a3dbb97f29cd99fbf56e0a2586ef (diff) |
glusterd : Made volume clear-locks use synctask framework.
Change-Id: Ia1fe3d0500d999c1f95b43c9e53947834e39d680
BUG: 852147
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4490
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-handler.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 10 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 11 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 3 |
7 files changed, 36 insertions, 16 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index fb94bba8960..96e142ce944 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -3038,12 +3038,9 @@ glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_INFO, "Received clear-locks volume req " "for volume %s", volname); - ret = glusterd_op_begin (req, cli_op, dict, err_str, sizeof (err_str)); + ret = glusterd_op_begin_synctask (req, GD_OP_CLEARLOCKS_VOLUME, dict); out: - glusterd_friend_sm (); - glusterd_op_sm (); - if (ret) { if (err_str[0] == '\0') snprintf (err_str, sizeof (err_str), diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 26e61b4f61c..29c03d6961e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3855,7 +3855,8 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr, break; case GD_OP_CLEARLOCKS_VOLUME: - ret = glusterd_op_clearlocks_volume (dict, op_errstr); + ret = glusterd_op_clearlocks_volume (dict, op_errstr, + rsp_dict); break; #ifdef HAVE_BD_XLATOR case GD_OP_BD_OP: diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index fa0aa47c0c2..370f454df5c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -595,6 +595,13 @@ glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp, break; + case GD_OP_CLEARLOCKS_VOLUME: + ret = glusterd_volume_clearlocks_use_rsp_dict (aggr, rsp); + if (ret) + goto out; + + break; + default: break; } @@ -696,7 +703,8 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) goto stage_done; } - if (op == GD_OP_REPLACE_BRICK) { + if ((op == GD_OP_REPLACE_BRICK) || + (op == GD_OP_CLEARLOCKS_VOLUME)) { ret = glusterd_syncop_aggr_rsp_dict (op, op_ctx, rsp_dict, op_errstr); if (ret) { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 14a32726abb..09fc5aa51ef 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6931,6 +6931,24 @@ out: } int +glusterd_volume_clearlocks_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) +{ + int ret = 0; + glusterd_op_t op = GD_OP_NONE; + + op = glusterd_op_get_op (); + GF_ASSERT (aggr); + GF_ASSERT (rsp_dict); + GF_ASSERT (GD_OP_CLEARLOCKS_VOLUME == op); + + if (!aggr) + goto out; + dict_copy (rsp_dict, aggr); +out: + return ret; +} + +int glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) { int ret = 0; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index b3abb13de05..b5f005560c2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -459,6 +459,8 @@ int glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +int +glusterd_volume_clearlocks_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int32_t glusterd_handle_node_rsp (dict_t *req_ctx, void *pending_entry, glusterd_op_t op, dict_t *rsp_dict, dict_t *op_ctx, diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index ce44f5fba0e..cf424abb2d5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1944,7 +1944,7 @@ out: } int -glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr) +glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, dict_t *rsp_dict) { int32_t ret = -1; int i = 0; @@ -1959,7 +1959,6 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr) char result[PATH_MAX] = {0,}; char *mntpt = NULL; char **xl_opts = NULL; - dict_t *ctx = NULL; glusterd_volinfo_t *volinfo = NULL; ret = dict_get_str (dict, "volname", &volname); @@ -2048,14 +2047,8 @@ glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr) goto umount; } - ctx = glusterd_op_get_ctx (); - if (!ctx) - /*Impossible. Only originator glusterd can - * come here. */ - goto umount; - free_ptr = gf_strdup(result); - if (dict_set_dynstr (ctx, "lk-summary", free_ptr)) { + if (dict_set_dynstr (rsp_dict, "lk-summary", free_ptr)) { GF_FREE (free_ptr); snprintf (msg, sizeof (msg), "Failed to set clear-locks " "result"); diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 95e23674c57..41b74a684dd 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -698,7 +698,8 @@ int glusterd_op_stage_statedump_volume (dict_t *dict, char **op_errstr); int glusterd_op_statedump_volume (dict_t *dict, char **op_errstr); int glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr); -int glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr); +int glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr, + dict_t *rsp_dict); int glusterd_op_stage_bd (dict_t *dict, char **op_errstr); /* misc */ |