summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorAnand <anekkunt@redhat.com>2015-01-14 22:23:05 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-01-20 22:33:58 -0800
commitf6a2f152aa9c8a66768e4ba0d1f66737c081639b (patch)
treec0dc8ee2108ecfe0c0acd4e4225773328ea658a0 /xlators/mgmt/glusterd/src
parentcdb3fa6088957ed257bfe2c3af59a80033cb2cbb (diff)
downloadglusterfs-f6a2f152aa9c8a66768e4ba0d1f66737c081639b.tar.gz
glusterfs-f6a2f152aa9c8a66768e4ba0d1f66737c081639b.tar.xz
glusterfs-f6a2f152aa9c8a66768e4ba0d1f66737c081639b.zip
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')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c45
2 files changed, 55 insertions, 31 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 403e13e367..8d344aa7b9 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);
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 357c0164a6..1de9e4603a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -324,9 +324,11 @@ gd_syncop_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
+ xlator_t *this = NULL;
+ this = THIS;
+ GF_ASSERT (this);
GF_ASSERT(req);
- GF_ASSERT(iov);
GF_ASSERT(myframe);
frame = myframe;
@@ -340,6 +342,9 @@ gd_syncop_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov,
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);
if (ret < 0)
@@ -413,9 +418,11 @@ gd_syncop_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
+ xlator_t *this = NULL;
+ this = THIS;
+ GF_ASSERT (this);
GF_ASSERT(req);
- GF_ASSERT(iov);
GF_ASSERT(myframe);
frame = myframe;
@@ -429,6 +436,9 @@ gd_syncop_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov,
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);
if (ret < 0)
@@ -503,6 +513,10 @@ _gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
frame = myframe;
args = frame->local;
@@ -515,6 +529,9 @@ _gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov,
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_cluster_lock_rsp);
if (ret < 0)
@@ -573,6 +590,10 @@ _gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
int op_ret = -1;
int op_errno = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
frame = myframe;
args = frame->local;
@@ -584,6 +605,9 @@ _gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov,
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_cluster_unlock_rsp);
if (ret < 0)
@@ -645,6 +669,8 @@ _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
int op_errno = -1;
this = THIS;
+ GF_ASSERT (this);
+
frame = myframe;
args = frame->local;
peerinfo = frame->cookie;
@@ -655,6 +681,9 @@ _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
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_stage_op_rsp);
if (ret < 0)
@@ -766,6 +795,10 @@ _gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
gd1_mgmt_brick_op_rsp rsp = {0,};
int ret = -1;
call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
frame = myframe;
args = frame->local;
@@ -780,6 +813,9 @@ _gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
+ GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, iov, out, args->op_errno,
+ EINVAL);
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gd1_mgmt_brick_op_rsp);
if (ret < 0)
@@ -902,6 +938,8 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
int type = GF_QUOTA_OPTION_TYPE_NONE;
this = THIS;
+ GF_ASSERT (this);
+
frame = myframe;
args = frame->local;
peerinfo = frame->cookie;
@@ -912,6 +950,9 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
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_commit_op_rsp);
if (ret < 0) {