From 61905d64188f2db8e33bfe7bc4c499844a6b4b3a Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Wed, 19 Dec 2012 18:03:42 +0530 Subject: glusterd: Add GF_ASSERT check in glusterd volume op handlers Change-Id: Iea6ac1e612812ba8ffc4b60899a9e574a3b09ea6 BUG: 873549 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/4346 Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Vijay Bellur Tested-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 1 + xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 4 ++-- xlators/mgmt/glusterd/src/glusterd-handler.c | 7 +++++++ xlators/mgmt/glusterd/src/glusterd-log-ops.c | 1 + xlators/mgmt/glusterd/src/glusterd-quota.c | 1 + xlators/mgmt/glusterd/src/glusterd-rebalance.c | 2 ++ xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 1 + xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 5 +++++ 8 files changed, 20 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 105e74079cf..19ae2ca2136 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -571,6 +571,7 @@ glusterd_handle_remove_brick (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 419f3ad025b..b1c64bb5300 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -52,11 +52,11 @@ glusterd_handle_gsync_set (rpcsvc_request_t *req) xlator_t *this = NULL; GF_ASSERT (req); - GF_ASSERT (THIS); - GF_ASSERT (THIS->private); this = THIS; + GF_ASSERT (this); priv = this->private; + GF_ASSERT (priv); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 21befaea16e..de729b3acf6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -458,6 +458,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx, GF_ASSERT (NULL != ctx); this = THIS; + GF_ASSERT (this); priv = this->private; GF_ASSERT (priv); @@ -1198,6 +1199,7 @@ glusterd_handle_reset_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { @@ -1268,6 +1270,7 @@ glusterd_handle_set_volume (rpcsvc_request_t *req) xlator_t *this = NULL; this = THIS; + GF_ASSERT (this); GF_ASSERT (req); @@ -1368,6 +1371,7 @@ glusterd_handle_sync_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { @@ -2061,6 +2065,7 @@ glusterd_handle_cli_profile_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { @@ -2898,6 +2903,7 @@ glusterd_handle_status_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { @@ -2973,6 +2979,7 @@ glusterd_handle_cli_clearlocks_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = -1; ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c index d4367a69a15..fa576212af3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c @@ -36,6 +36,7 @@ glusterd_handle_log_rotate (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 7b793f6f051..b2379a510d3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -39,6 +39,7 @@ glusterd_handle_quota (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 3fb00b6de5b..f07bd952761 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -389,8 +389,10 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); priv = this->private; + GF_ASSERT (priv); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index b6580a16852..7e4d8c78b2c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -85,6 +85,7 @@ glusterd_handle_replace_brick (rpcsvc_request_t *req) GF_ASSERT (req); this = THIS; + GF_ASSERT (this); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); if (ret < 0) { diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index c70556a5895..6f933e6818c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -235,6 +235,7 @@ glusterd_handle_cli_start_volume (rpcsvc_request_t *req) xlator_t *this = NULL; this = THIS; + GF_ASSERT (this); GF_ASSERT (req); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); @@ -303,6 +304,7 @@ glusterd_handle_cli_stop_volume (rpcsvc_request_t *req) char err_str[2048] = {0,}; this = THIS; + GF_ASSERT (this); GF_ASSERT (req); ret = xdr_to_generic (req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); @@ -374,6 +376,7 @@ glusterd_handle_cli_delete_volume (rpcsvc_request_t *req) xlator_t *this = NULL; this = THIS; + GF_ASSERT (this); GF_ASSERT (req); @@ -457,6 +460,7 @@ glusterd_handle_cli_heal_volume (rpcsvc_request_t *req) } this = THIS; + GF_ASSERT (this); if (cli_req.dict.dict_len) { /* Unserialize the dictionary */ @@ -538,6 +542,7 @@ glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req) xlator_t *this = NULL; this = THIS; + GF_ASSERT (this); GF_ASSERT (req); -- cgit