summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2015-12-18 15:21:27 -0500
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-02-15 01:32:14 -0800
commit62f9659554c07317c9d06251b74171d9eac0917e (patch)
treeb6296bf8e990d7e027c91ebf8e85c5ff7b1f3dea
parent954f2901345f42177033418112c052ed0795b295 (diff)
all: fix various cppcheck warnings
fixes for various warnings reported by cppcheck N.B. cppcheck output is in the bugzilla Change-Id: I33acec127bc4536935fdd8d52a0c490ec54d50b2 BUG: 1292954 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13006 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--cli/src/cli-rpc-ops.c332
-rw-r--r--cli/src/cli.c12
-rw-r--r--xlators/cluster/dht/src/dht-rename.c4
-rw-r--r--xlators/debug/io-stats/src/io-stats.c13
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c12
7 files changed, 246 insertions, 137 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 6a29617..4b4fa39 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -116,6 +116,8 @@ gf_cli_probe_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -168,6 +170,8 @@ gf_cli_deprobe_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -381,7 +385,10 @@ gf_cli_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
unsigned long flags = 0;
+ GF_ASSERT (myframe);
+
frame = myframe;
+
flags = (long)frame->local;
if (flags == GF_CLI_LIST_POOL_NODES) {
@@ -401,7 +408,7 @@ gf_cli_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf1_cli_peer_list_rsp);
if (ret < 0) {
- gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
+ gf_log (frame->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
//rsp.op_ret = -1;
//rsp.op_errno = EINVAL;
@@ -785,13 +792,22 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
gf_cli_rsp rsp = {0};
char *caps = NULL;
int k __attribute__((unused)) = 0;
+ call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (-1 == req->rpc_status)
goto out;
+ frame = myframe;
+
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
+ gf_log (frame->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
@@ -833,8 +849,6 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
if (ret)
goto out;
- local = ((call_frame_t *)myframe)->local;
-
if (!count) {
switch (local->get_vol.flags) {
@@ -1065,31 +1079,35 @@ int
gf_cli_create_volume_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe)
{
- gf_cli_rsp rsp = {0,};
- int ret = -1;
- cli_local_t *local = NULL;
- char *volname = NULL;
- dict_t *dict = NULL;
+ gf_cli_rsp rsp = {0,};
+ int ret = -1;
+ cli_local_t *local = NULL;
+ char *volname = NULL;
dict_t *rsp_dict = NULL;
+ call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (-1 == req->rpc_status) {
goto out;
}
- local = ((call_frame_t *) (myframe))->local;
+ frame = myframe;
+
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
+ gf_log (frame->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
gf_log ("cli", GF_LOG_INFO, "Received resp to create volume");
- dict = local->dict;
-
- ret = dict_get_str (dict, "volname", &volname);
+ ret = dict_get_str (local->dict, "volname", &volname);
if (ret)
goto out;
@@ -1141,15 +1159,20 @@ gf_cli_delete_volume_cbk (struct rpc_req *req, struct iovec *iov,
cli_local_t *local = NULL;
char *volname = NULL;
call_frame_t *frame = NULL;
- dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -1157,11 +1180,7 @@ gf_cli_delete_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- local = frame->local;
-
- if (local)
- dict = local->dict;
- ret = dict_get_str (dict, "volname", &volname);
+ ret = dict_get_str (local->dict, "volname", &volname);
if (ret) {
gf_log (frame->this->name, GF_LOG_ERROR,
"dict get failed");
@@ -1221,11 +1240,17 @@ gf_cli3_1_uuid_get_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
dict_t *dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -1233,7 +1258,6 @@ gf_cli3_1_uuid_get_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- local = frame->local;
frame->local = NULL;
gf_log ("cli", GF_LOG_INFO, "Received resp to uuid get");
@@ -1300,12 +1324,18 @@ gf_cli3_1_uuid_reset_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
dict_t *dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -1313,7 +1343,6 @@ gf_cli3_1_uuid_reset_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- local = frame->local;
frame->local = NULL;
gf_log ("cli", GF_LOG_INFO, "Received resp to uuid reset");
@@ -1355,15 +1384,20 @@ gf_cli_start_volume_cbk (struct rpc_req *req, struct iovec *iov,
cli_local_t *local = NULL;
char *volname = NULL;
call_frame_t *frame = NULL;
- dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -1371,13 +1405,7 @@ gf_cli_start_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
-
- if (local)
- dict = local->dict;
-
- ret = dict_get_str (dict, "volname", &volname);
+ ret = dict_get_str (local->dict, "volname", &volname);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "dict get failed");
goto out;
@@ -1433,15 +1461,20 @@ gf_cli_stop_volume_cbk (struct rpc_req *req, struct iovec *iov,
cli_local_t *local = NULL;
char *volname = NULL;
call_frame_t *frame = NULL;
- dict_t *dict = NULL;
dict_t *rsp_dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -1449,17 +1482,11 @@ gf_cli_stop_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
-
- if (local) {
- dict = local->dict;
- ret = dict_get_str (dict, "volname", &volname);
- if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "Unable to get volname from dict");
- goto out;
- }
+ ret = dict_get_str (local->dict, "volname", &volname);
+ if (ret) {
+ gf_log (frame->this->name, GF_LOG_ERROR,
+ "Unable to get volname from dict");
+ goto out;
}
gf_log ("cli", GF_LOG_INFO, "Received resp to stop volume");
@@ -1716,7 +1743,6 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
int cmd = 0;
int ret = -1;
dict_t *dict = NULL;
- dict_t *local_dict = NULL;
char msg[1024] = {0,};
char *task_id_str = NULL;
@@ -1724,8 +1750,14 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
+ GF_ASSERT (myframe);
+
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -1734,20 +1766,15 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
-
- if (local)
- local_dict = local->dict;
-
- ret = dict_get_str (local_dict, "volname", &volname);
+ ret = dict_get_str (local->dict, "volname", &volname);
if (ret) {
gf_log (frame->this->name, GF_LOG_ERROR,
"Failed to get volname");
goto out;
}
- ret = dict_get_int32 (local_dict, "rebalance-command", (int32_t*)&cmd);
+ ret = dict_get_int32 (local->dict, "rebalance-command",
+ (int32_t *)&cmd);
if (ret) {
gf_log ("cli", GF_LOG_ERROR,
"Failed to get command");
@@ -1913,6 +1940,8 @@ gf_cli_rename_volume_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -1957,6 +1986,9 @@ gf_cli_reset_volume_cbk (struct rpc_req *req, struct iovec *iov,
gf_cli_rsp rsp = {0,};
int ret = -1;
char msg[1024] = {0,};
+ call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (-1 == req->rpc_status) {
goto out;
@@ -2009,6 +2041,8 @@ gf_cli_ganesha_cbk (struct rpc_req *req, struct iovec *iov,
char msg[1024] = {0,};
char tmp_str[512] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -2112,6 +2146,8 @@ gf_cli_set_volume_cbk (struct rpc_req *req, struct iovec *iov,
char *debug_xlator = NULL;
char tmp_str[512] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -2193,6 +2229,8 @@ gf_cli_attach_tier_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -2250,11 +2288,16 @@ gf_cli_detach_tier_cbk (struct rpc_req *req, struct iovec *iov,
char *task_id_str = NULL;
dict_t *rsp_dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+
+ GF_ASSERT (frame->local);
+
local = frame->local;
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
@@ -2368,12 +2411,18 @@ gf_cli_detach_tier_status_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
char *cmd_str = "unknown";
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -2382,11 +2431,10 @@ gf_cli_detach_tier_status_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
ret = dict_get_int32 (local->dict, "command", &command);
if (ret)
goto out;
+
cmd = command;
switch (cmd) {
@@ -2489,6 +2537,8 @@ gf_cli_add_brick_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -2545,12 +2595,18 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
char *cmd_str = "unknown";
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -2559,11 +2615,10 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
ret = dict_get_int32 (local->dict, "command", &command);
if (ret)
goto out;
+
cmd = command;
switch (cmd) {
@@ -2673,11 +2728,16 @@ gf_cli_remove_brick_cbk (struct rpc_req *req, struct iovec *iov,
char *task_id_str = NULL;
dict_t *rsp_dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+
+ GF_ASSERT (frame->local);
+
local = frame->local;
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
@@ -2783,7 +2843,6 @@ gf_cli_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
cli_local_t *local = NULL;
call_frame_t *frame = NULL;
- dict_t *dict = NULL;
char *src_brick = NULL;
char *dst_brick = NULL;
char *status_reply = NULL;
@@ -2793,11 +2852,17 @@ gf_cli_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,
char *task_id_str = NULL;
char *replace_op = 0;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
- frame = (call_frame_t *) myframe;
+ frame = myframe;
+
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -2806,11 +2871,7 @@ gf_cli_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- local = frame->local;
- GF_ASSERT (local);
- dict = local->dict;
-
- ret = dict_get_str (dict, "operation", &replace_op);
+ ret = dict_get_str (local->dict, "operation", &replace_op);
if (ret) {
gf_log (frame->this->name, GF_LOG_ERROR,
"dict_get on operation failed");
@@ -2897,6 +2958,8 @@ gf_cli_log_rotate_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -2946,6 +3009,8 @@ gf_cli_sync_volume_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -3466,23 +3531,24 @@ cli_quotad_getlimit_cbk (struct rpc_req *req, struct iovec *iov,
dict_t *dict = NULL;
call_frame_t *frame = NULL;
cli_local_t *local = NULL;
- dict_t *gd_rsp_dict = NULL;
int32_t list_count = 0;
pthread_t th_id = {0, };
+ GF_ASSERT (myframe);
+
frame = myframe;
- GF_ASSERT (frame);
+
+ GF_ASSERT (frame->local);
local = frame->local;
- gd_rsp_dict = local->dict;
LOCK (&local->lock);
{
- ret = dict_get_int32 (gd_rsp_dict, "quota-list-count",
+ ret = dict_get_int32 (local->dict, "quota-list-count",
&list_count);
if (ret)
list_count = 0;
- ret = dict_set_int32 (gd_rsp_dict, "quota-list-count",
+ ret = dict_set_int32 (local->dict, "quota-list-count",
list_count + 1);
}
UNLOCK (&local->lock);
@@ -3631,16 +3697,20 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
char *default_sl = NULL;
char *limit_list = NULL;
cli_local_t *local = NULL;
- dict_t *aggr = NULL;
char *default_sl_dup = NULL;
int32_t entry_count = 0;
+
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+
+ GF_ASSERT (frame->local);
+
local = frame->local;
- aggr = local->dict;
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -3701,7 +3771,7 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
ret = -1;
goto out;
}
- ret = dict_set_dynstr (aggr, "default-soft-limit",
+ ret = dict_set_dynstr (local->dict, "default-soft-limit",
default_sl_dup);
if (ret) {
gf_log (frame->this->name, GF_LOG_TRACE,
@@ -3768,23 +3838,22 @@ gf_cli_getspec_cbk (struct rpc_req *req, struct iovec *iov,
gf_getspec_rsp rsp = {0,};
int ret = -1;
char *spec = NULL;
- call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (-1 == req->rpc_status) {
goto out;
}
- frame = myframe;
-
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
if (rsp.op_ret == -1) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"getspec failed");
goto out;
}
@@ -3815,23 +3884,22 @@ gf_cli_pmap_b2p_cbk (struct rpc_req *req, struct iovec *iov,
pmap_port_by_brick_rsp rsp = {0,};
int ret = -1;
char *spec = NULL;
- call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (-1 == req->rpc_status) {
goto out;
}
- frame = myframe;
-
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
if (rsp.op_ret == -1) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"pump_b2p failed");
goto out;
}
@@ -4890,6 +4958,8 @@ gf_cli_fsm_log_cbk (struct rpc_req *req, struct iovec *iov,
char *event = NULL;
char *time = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -5442,18 +5512,16 @@ gf_cli_sys_exec_cbk (struct rpc_req *req, struct iovec *iov,
char output_name[PATH_MAX] = "";
gf_cli_rsp rsp = {0, };
dict_t *dict = NULL;
- call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (req->rpc_status == -1) {
- ret = -1;
goto out;
}
- frame = myframe;
-
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
@@ -5531,18 +5599,16 @@ gf_cli_copy_file_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
gf_cli_rsp rsp = {0, };
dict_t *dict = NULL;
- call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (req->rpc_status == -1) {
- ret = -1;
goto out;
}
- frame = myframe;
-
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
@@ -5592,9 +5658,9 @@ gf_cli_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
call_frame_t *frame = NULL;
gf_boolean_t status_detail = _gf_false;
+ GF_ASSERT (myframe);
if (req->rpc_status == -1) {
- ret = -1;
goto out;
}
@@ -5602,7 +5668,7 @@ gf_cli_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
@@ -5643,7 +5709,8 @@ gf_cli_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
ret = dict_get_int32 (dict, "type", &type);
if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR, "failed to get type");
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
+ "failed to get type");
goto out;
}
@@ -5996,6 +6063,8 @@ gf_cli_profile_volume_cbk (struct rpc_req *req, struct iovec *iov,
int stats_cleared = 0;
gf1_cli_info_op info_op = GF_CLI_INFO_NONE;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -6200,6 +6269,8 @@ gf_cli_top_volume_cbk (struct rpc_req *req, struct iovec *iov,
gf_boolean_t clear_stats = _gf_false;
int stats_cleared = 0;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -6439,6 +6510,8 @@ gf_cli_getwd_cbk (struct rpc_req *req, struct iovec *iov,
gf1_cli_getwd_rsp rsp = {0,};
int ret = -1;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -7582,6 +7655,8 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,
gf_boolean_t wipe_local = _gf_false;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (req->rpc_status == -1)
goto out;
@@ -7594,7 +7669,7 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,
gf_log ("cli", GF_LOG_DEBUG, "Received response to status cmd");
- local = ((call_frame_t *)myframe)->local;
+ local = ((call_frame_t *) myframe)->local;
if (!local) {
local = cli_local_get ();
if (!local) {
@@ -7900,18 +7975,22 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data)
dict_t *dict = NULL;
cli_local_t *local = NULL;
- if (frame->local) {
- local = frame->local;
- local->all = _gf_true;
- } else
+ if (!frame)
goto out;
+ if (!frame->local)
+ goto out;
+
+ local = frame->local;
+
ret = dict_get_uint32 (local->dict, "cmd", &cmd);
if (ret)
goto out;
+ local->all = _gf_true;
ret = gf_cli_status_volume (frame, this, data);
+
if (ret)
goto out;
@@ -8002,6 +8081,8 @@ gf_cli_mount_cbk (struct rpc_req *req, struct iovec *iov,
gf1_cli_mount_rsp rsp = {0,};
int ret = -1;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -8070,6 +8151,8 @@ gf_cli_umount_cbk (struct rpc_req *req, struct iovec *iov,
gf1_cli_umount_rsp rsp = {0,};
int ret = -1;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
@@ -8363,7 +8446,6 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
cli_local_t *local = NULL;
char *volname = NULL;
call_frame_t *frame = NULL;
- dict_t *input_dict = NULL;
dict_t *dict = NULL;
int brick_count = 0;
int i = 0;
@@ -8372,12 +8454,18 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
char *substr = NULL;
char *heal_op_str = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status) {
goto out;
}
frame = myframe;
+ GF_ASSERT (frame->local);
+
+ local = frame->local;
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR,
@@ -8385,14 +8473,7 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (frame)
- local = frame->local;
-
- if (local) {
- input_dict = local->dict;
- ret = dict_get_int32 (input_dict, "heal-op",
- (int32_t*)&heal_op);
- }
+ ret = dict_get_int32 (local->dict, "heal-op", (int32_t *)&heal_op);
//TODO: Proper XML output
//#if (HAVE_LIB_XML)
// if (global_state->mode & GLUSTER_MODE_XML) {
@@ -8405,7 +8486,7 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
// }
//#endif
- ret = dict_get_str (input_dict, "volname", &volname);
+ ret = dict_get_str (local->dict, "volname", &volname);
if (ret) {
gf_log (frame->this->name, GF_LOG_ERROR, "failed to get volname");
goto out;
@@ -8578,10 +8659,12 @@ gf_cli_statedump_volume_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
char msg[1024] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
- ret = xdr_to_generic (*iov, &rsp,
- (xdrproc_t)xdr_gf_cli_rsp);
+
+ ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
@@ -8650,8 +8733,11 @@ gf_cli_list_volume_cbk (struct rpc_req *req, struct iovec *iov,
char key[1024] = {0,};
int i = 0;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -8738,8 +8824,11 @@ gf_cli_clearlocks_volume_cbk (struct rpc_req *req, struct iovec *iov,
char *volname = NULL;
dict_t *dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
+
ret = xdr_to_generic (*iov, &rsp,
(xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
@@ -9839,8 +9928,9 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
int8_t soft_limit_flag = -1;
char *volname = NULL;
+ GF_ASSERT (myframe);
+
if (req->rpc_status == -1) {
- ret = -1;
goto out;
}
@@ -10439,10 +10529,12 @@ gf_cli_barrier_volume_cbk (struct rpc_req *req, struct iovec *iov,
int ret = -1;
dict_t *dict = NULL;
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
- ret = xdr_to_generic (*iov, &rsp,
- (xdrproc_t)xdr_gf_cli_rsp);
+
+ ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
@@ -10507,10 +10599,12 @@ gf_cli_get_vol_opt_cbk (struct rpc_req *req, struct iovec *iov, int count,
int i = 0;
char dict_key[50] = {0,};
+ GF_ASSERT (myframe);
+
if (-1 == req->rpc_status)
goto out;
- ret = xdr_to_generic (*iov, &rsp,
- (xdrproc_t)xdr_gf_cli_rsp);
+
+ ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
@@ -10844,18 +10938,16 @@ gf_cli_bitrot_cbk (struct rpc_req *req, struct iovec *iov,
int type = 0;
gf_cli_rsp rsp = {0, };
dict_t *dict = NULL;
- call_frame_t *frame = NULL;
+
+ GF_ASSERT (myframe);
if (req->rpc_status == -1) {
- ret = -1;
goto out;
}
- frame = myframe;
-
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp);
if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_ERROR,
+ gf_log (((call_frame_t *) myframe)->this->name, GF_LOG_ERROR,
"Failed to decode xdr response");
goto out;
}
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 46736bb..118a94f 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -496,8 +496,10 @@ _cli_err (const char *fmt, ...)
va_start (ap, fmt);
#ifdef HAVE_READLINE
- if (state->rl_enabled && !state->rl_processing)
- return cli_rl_err(state, fmt, ap);
+ if (state->rl_enabled && !state->rl_processing) {
+ va_end (ap);
+ return cli_rl_err (state, fmt, ap);
+ }
#endif
ret = vfprintf (stderr, fmt, ap);
@@ -520,8 +522,10 @@ _cli_out (const char *fmt, ...)
va_start (ap, fmt);
#ifdef HAVE_READLINE
- if (state->rl_enabled && !state->rl_processing)
- return cli_rl_out(state, fmt, ap);
+ if (state->rl_enabled && !state->rl_processing) {
+ va_end (ap);
+ return cli_rl_out (state, fmt, ap);
+ }
#endif
ret = vprintf (fmt, ap);
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 3b18201..5170fac 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -960,11 +960,9 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
xlator_t *src_cached = NULL;
dict_t *xattr = NULL;
- DHT_MARK_FOP_INTERNAL (xattr);
-
local = frame->local;
+ DHT_MARK_FOP_INTERNAL (xattr);
prev = cookie;
-
src_cached = local->src_cached;
if (op_ret == -1) {
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 8ce2ebb..eb604ea 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -651,7 +651,8 @@ ios_stats_cleanup (xlator_t *this, inode_t *inode)
} while (0)
int
-ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this, FILE* logfp)
+ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this,
+ FILE *logfp)
{
struct ios_stat_list *entry = NULL;
@@ -668,7 +669,7 @@ ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this, FILE* logf
int
ios_dump_throughput_stats (struct ios_stat_head *list_head, xlator_t *this,
- FILE* logfp, ios_stats_type_t type)
+ FILE *logfp, ios_stats_thru_t type)
{
struct ios_stat_list *entry = NULL;
struct timeval time = {0, };
@@ -1138,7 +1139,7 @@ out:
int
io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats,
- struct timeval *now, int interval, FILE* logfp)
+ struct timeval *now, int interval, FILE *logfp)
{
int i = 0;
int per_line = 0;
@@ -1280,13 +1281,15 @@ io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats,
ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"
"\tFILE NAME");
list_head = &conf->thru_list[IOS_STATS_THRU_READ];
- ios_dump_throughput_stats(list_head, this, logfp, IOS_STATS_TYPE_READ);
+ ios_dump_throughput_stats(list_head, this, logfp,
+ IOS_STATS_THRU_READ);
ios_log (this, logfp, "\n======Write Throughput File Stats======");
ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"
"\tFILE NAME");
list_head = &conf->thru_list[IOS_STATS_THRU_WRITE];
- ios_dump_throughput_stats (list_head, this, logfp, IOS_STATS_TYPE_WRITE);
+ ios_dump_throughput_stats (list_head, this, logfp,
+ IOS_STATS_THRU_WRITE);
}
return 0;
}
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 4ee2020..e4d9113 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -1685,6 +1685,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
"called");
va_start (ap, data);
output = va_arg (ap, dict_t *);
+ va_end (ap);
ret = br_scrubber_status_get (this, &output);
gf_msg_debug (this->name, 0, "returning %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 608b6dd..c86587f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2274,6 +2274,9 @@ __glusterd_handle_fsm_log (rpcsvc_request_t *req)
GF_ASSERT (req);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("xlator", (this != NULL), out);
+
ret = xdr_to_generic (req->msg[0], &cli_req,
(xdrproc_t)xdr_gf1_cli_fsm_log_req);
if (ret < 0) {
@@ -2293,7 +2296,6 @@ __glusterd_handle_fsm_log (rpcsvc_request_t *req)
}
if (strcmp ("", cli_req.name) == 0) {
- this = THIS;
conf = this->private;
ret = glusterd_sm_tr_log_add_to_dict (dict, &conf->op_sm_log);
} else {
@@ -2917,6 +2919,9 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
GF_ASSERT (req);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("xlator", (this != NULL), out);
+
ret = xdr_to_generic (req->msg[0], &probe_req,
(xdrproc_t)xdr_gd1_mgmt_probe_req);
if (ret < 0) {
@@ -2928,8 +2933,6 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
goto out;
}
- this = THIS;
-
conf = this->private;
if (probe_req.port)
port = probe_req.port;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 3373c93..cb1c8e9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -6178,9 +6178,9 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
{
int32_t ret = -1;
char *name = NULL;
+ char *volname = NULL;
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- glusterd_volinfo_t *volinfo = NULL;
glusterd_snap_t *snap = NULL;
this = THIS;
@@ -6194,11 +6194,19 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
+ ret = dict_get_str (dict, "volname", &volname);
+ if (ret) {
+ gf_msg ("glusterd", GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get"
+ " volume name");
+ goto out;
+ }
+
ret = dict_get_str (dict, "snapname", &name);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "getting the snap "
- "name failed (volume: %s)", volinfo->volname);
+ "name failed (volume: %s)", volname);
goto out;
}