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>
This commit is contained in:
parent
81301d3b00
commit
72c8b09640
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user