summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-09-05 07:32:20 +0000
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-12-19 22:05:47 -0800
commit72c8b09640976ecf0c2a50dcf92a1b8648e723d4 (patch)
tree6a1afba9f45b0d15f7e1ddff453c62faa5670520 /xlators/mgmt
parent81301d3b006e5490699d5bf70833d92b05a47dca (diff)
glusterd: Returning success from mgmt_v3 handler functions
The mgmt_v3 handler functions already send the ret code as part of the *send_resp calls, and further propagating the ret code to the calling functions will lead to double deletion of the req object. Hence returning success from the mgmt_v3 handler functions. Change-Id: I1090e49c54a786daae5fd97b5c1fbcb5d819acba BUG: 1138577 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/8620 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c50
1 files changed, 42 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index c0c1cfcba18..fc9b987ece6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -178,13 +178,30 @@ glusterd_handle_mgmt_v3_lock_fn (rpcsvc_request_t *req)
"is_synctasked", _gf_false);
if (is_synctasked) {
ret = glusterd_synctasked_mgmt_v3_lock (req, &lock_req, ctx);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to acquire mgmt_v3_locks");
+ /* Ignore the return code, as it shouldn't be propagated
+ * from the handler function so as to avoid double
+ * deletion of the req
+ */
+ ret = 0;
+ }
+
/* The above function does not take ownership of ctx.
* Therefore we need to free the ctx explicitly. */
free_ctx = _gf_true;
}
else {
+ /* Shouldn't ignore the return code here, and it should
+ * be propagated from the handler function as in failure
+ * case it doesn't delete the req object
+ */
ret = glusterd_op_state_machine_mgmt_v3_lock (req, &lock_req,
ctx);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to acquire mgmt_v3_locks");
}
out:
@@ -324,8 +341,8 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
- return ret;
+ /* Return 0 from handler to avoid double deletion of req obj */
+ return 0;
}
static int
@@ -449,8 +466,8 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
- return ret;
+ /* Return 0 from handler to avoid double deletion of req obj */
+ return 0;
}
static int
@@ -573,8 +590,8 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
- return ret;
+ /* Return 0 from handler to avoid double deletion of req obj */
+ return 0;
}
static int
@@ -699,8 +716,8 @@ out:
if (rsp_dict)
dict_unref (rsp_dict);
- gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
- return ret;
+ /* Return 0 from handler to avoid double deletion of req obj */
+ return 0;
}
static int
@@ -844,13 +861,30 @@ glusterd_handle_mgmt_v3_unlock_fn (rpcsvc_request_t *req)
"is_synctasked", _gf_false);
if (is_synctasked) {
ret = glusterd_syctasked_mgmt_v3_unlock (req, &lock_req, ctx);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to release mgmt_v3_locks");
+ /* Ignore the return code, as it shouldn't be propagated
+ * from the handler function so as to avoid double
+ * deletion of the req
+ */
+ ret = 0;
+ }
+
/* The above function does not take ownership of ctx.
* Therefore we need to free the ctx explicitly. */
free_ctx = _gf_true;
}
else {
+ /* Shouldn't ignore the return code here, and it should
+ * be propagated from the handler function as in failure
+ * case it doesn't delete the req object
+ */
ret = glusterd_op_state_machine_mgmt_v3_unlock (req, &lock_req,
ctx);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to release mgmt_v3_locks");
}
out: