diff options
author | Anand <anekkunt@redhat.com> | 2015-01-14 22:23:05 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-01-20 22:33:58 -0800 |
commit | f6a2f152aa9c8a66768e4ba0d1f66737c081639b (patch) | |
tree | c0dc8ee2108ecfe0c0acd4e4225773328ea658a0 /xlators/mgmt/glusterd/src/glusterd-mgmt.c | |
parent | cdb3fa6088957ed257bfe2c3af59a80033cb2cbb (diff) |
glusterd: Added iov error checking in rpc callbacks.
Problem : glusterd was crashing with SIGABRT if rpc connection is failed in
debug mode.
Reason : It was happening due to iov is passing to assert() before checking
rpc status in rpc call back function (rpc is calling callback function with
setting rpc status as -1 and passing NULL to iov if connection is failed).
Fix : Error checking for iov added after checking the rpc status verified
and error messages are added properly .
Change-Id: I35c05c438444d0454aadac4e45524565a7be68a8
BUG: 1181543
Signed-off-by: Anand <anekkunt@redhat.com>
Reviewed-on: http://review.gluster.org/9449
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 403e13e3678..8d344aa7b9a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -310,11 +310,8 @@ gd_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - goto out; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp); @@ -525,10 +522,8 @@ gd_mgmt_v3_pre_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_pre_val_rsp); @@ -793,11 +788,8 @@ gd_mgmt_v3_brick_op_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - goto out; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_brick_op_rsp); @@ -985,11 +977,8 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - goto out; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_commit_rsp); @@ -1216,11 +1205,8 @@ gd_mgmt_v3_post_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - goto out; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_post_val_rsp); @@ -1410,11 +1396,8 @@ gd_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov, goto out; } - if (!iov) { - gf_log (this->name, GF_LOG_ERROR, "iov is NULL"); - op_errno = EINVAL; - goto out; - } + GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, op_errno, + EINVAL); ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp); |