summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-mgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 380f149a9..e24faa0be 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -1393,6 +1393,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
dict_t *dict)
{
int ret = -1;
+ int op_ret = -1;
int npeers = 0;
dict_t *req_dict = NULL;
dict_t *tmp_dict = NULL;
@@ -1438,7 +1439,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
* the unlock and the volname in the dict might be removed */
tmp_dict = dict_new();
if (!tmp_dict) {
- gf_log ("", GF_LOG_ERROR, "Unable to create dict");
+ gf_log (this->name, GF_LOG_ERROR, "Unable to create dict");
goto out;
}
dict_copy (dict, tmp_dict);
@@ -1451,7 +1452,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_initiate_lockdown (conf, op, dict, &op_errstr,
npeers, &is_acquired);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
+ gf_log (this->name, GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
goto out;
}
@@ -1469,7 +1470,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_pre_validate (conf, op, req_dict,
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Pre Validation Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Pre Validation Failed");
goto out;
}
@@ -1477,7 +1478,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_commit (conf, op, dict, req_dict,
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Commit Op Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Commit Op Failed");
goto out;
}
@@ -1489,31 +1490,32 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_post_validate (conf, op, 0, req_dict,
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Post Validation Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Post Validation Failed");
goto out;
}
ret = 0;
out:
+ op_ret = ret;
/* UNLOCK PHASE FOR PEERS*/
(void) glusterd_mgmt_v3_release_peer_locks (conf, op, dict,
- ret, &op_errstr,
+ op_ret, &op_errstr,
npeers, is_acquired);
- /* SEND CLI RESPONSE */
- glusterd_op_send_cli_response (op, ret, 0, req, dict, op_errstr);
-
/* LOCAL VOLUME(S) UNLOCK */
- if (!is_acquired)
- goto cleanup;
+ if (is_acquired) {
+ /* Trying to release multiple mgmt_v3 locks */
+ ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to release mgmt_v3 locks on localhost");
+ op_ret = ret;
+ }
+ }
- /* Trying to release multiple mgmt_v3 locks */
- ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
- if (ret)
- gf_log ("", GF_LOG_ERROR,
- "Failed to release mgmt_v3 locks on localhost");
+ /* SEND CLI RESPONSE */
+ glusterd_op_send_cli_response (op, op_ret, 0, req, dict, op_errstr);
-cleanup:
if (req_dict)
dict_unref (req_dict);
@@ -1533,6 +1535,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
dict_t *dict)
{
int ret = -1;
+ int op_ret = -1;
int npeers = 0;
dict_t *req_dict = NULL;
dict_t *tmp_dict = NULL;
@@ -1543,7 +1546,6 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
uuid_t *originator_uuid = NULL;
gf_boolean_t success = _gf_false;
char *tmp_errstr = NULL;
- int op_ret = -1;
this = THIS;
GF_ASSERT (this);
@@ -1581,7 +1583,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
* the unlock and the volname in the dict might be removed */
tmp_dict = dict_new();
if (!tmp_dict) {
- gf_log ("", GF_LOG_ERROR, "Unable to create dict");
+ gf_log (this->name, GF_LOG_ERROR, "Unable to create dict");
goto out;
}
dict_copy (dict, tmp_dict);
@@ -1594,7 +1596,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_initiate_lockdown (conf, op, dict, &op_errstr,
npeers, &is_acquired);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
+ gf_log (this->name, GF_LOG_ERROR, "mgmt_v3 lockdown failed.");
goto out;
}
@@ -1612,7 +1614,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_pre_validate (conf, op, req_dict,
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Pre Validation Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Pre Validation Failed");
goto out;
}
@@ -1648,7 +1650,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
ret = glusterd_mgmt_v3_commit (conf, op, dict, req_dict,
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Commit Op Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Commit Op Failed");
/* If the main op fails, we should save the error string.
Because, op_errstr will be used for unbarrier and
unlock ops also. We might lose the actual error that
@@ -1669,7 +1671,7 @@ unbarrier:
&op_errstr, npeers);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Brick Ops Failed");
+ gf_log (this->name, GF_LOG_ERROR, "Brick Ops Failed");
goto out;
}
@@ -1710,21 +1712,20 @@ out:
op_errstr = tmp_errstr;
}
- /* SEND CLI RESPONSE */
-
- glusterd_op_send_cli_response (op, op_ret, 0, req, dict, op_errstr);
-
/* LOCAL VOLUME(S) UNLOCK */
- if (!is_acquired)
- goto cleanup;
+ if (is_acquired) {
+ /* Trying to release multiple mgmt_v3 locks */
+ ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to release mgmt_v3 locks on localhost");
+ op_ret = ret;
+ }
+ }
- /* Trying to release multiple mgmt_v3 locks */
- ret = glusterd_multiple_mgmt_v3_unlock (tmp_dict, MY_UUID);
- if (ret)
- gf_log ("", GF_LOG_ERROR,
- "Failed to release mgmt_v3 locks on localhost");
+ /* SEND CLI RESPONSE */
+ glusterd_op_send_cli_response (op, op_ret, 0, req, dict, op_errstr);
-cleanup:
if (req_dict)
dict_unref (req_dict);