|
|
14f8ab |
From aa215163cb7d806dc98bef2386a4e282a5e54a31 Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
14f8ab |
Date: Thu, 25 Apr 2019 12:00:52 +0530
|
|
|
14f8ab |
Subject: [PATCH 432/449] glusterd: Fix coverity defects & put coverity
|
|
|
14f8ab |
annotations
|
|
|
14f8ab |
|
|
|
14f8ab |
Along with fixing few defect, put the required annotations for the defects which
|
|
|
14f8ab |
are marked ignore/false positive/intentional as per the coverity defect sheet.
|
|
|
14f8ab |
This should avoid the per component graph showing many defects as open in the
|
|
|
14f8ab |
coverity glusterfs web page.
|
|
|
14f8ab |
|
|
|
14f8ab |
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22619/
|
|
|
14f8ab |
> Updates: bz#789278
|
|
|
14f8ab |
> Change-Id: I19461dc3603a3bd8f88866a1ab3db43d783af8e4
|
|
|
14f8ab |
> Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
14f8ab |
|
|
|
14f8ab |
BUG: 1787310
|
|
|
14f8ab |
Change-Id: I19461dc3603a3bd8f88866a1ab3db43d783af8e4
|
|
|
14f8ab |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202631
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 7 +++--
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 3 +-
|
|
|
14f8ab |
.../glusterd/src/glusterd-gfproxyd-svc-helper.c | 2 +-
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-handler.c | 8 ++++-
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-mountbroker.c | 5 ++-
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 8 +++++
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-peer-utils.c | 2 ++
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 1 +
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-store.c | 4 ---
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 4 +--
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-syncop.c | 1 +
|
|
|
14f8ab |
.../mgmt/glusterd/src/glusterd-tierd-svc-helper.c | 4 +--
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++--
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-volgen.c | 36 +++++++++++++---------
|
|
|
14f8ab |
14 files changed, 63 insertions(+), 31 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
14f8ab |
index d424f31..121346c 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
14f8ab |
@@ -2032,7 +2032,6 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
case GF_OP_CMD_STATUS:
|
|
|
14f8ab |
ret = 0;
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
-
|
|
|
14f8ab |
case GF_OP_CMD_DETACH_START:
|
|
|
14f8ab |
if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
|
|
|
14f8ab |
snprintf(msg, sizeof(msg),
|
|
|
14f8ab |
@@ -2044,7 +2043,7 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
errstr);
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+ /* Fall through */
|
|
|
14f8ab |
case GF_OP_CMD_START: {
|
|
|
14f8ab |
if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) &&
|
|
|
14f8ab |
dict_getn(dict, "replica-count", SLEN("replica-count"))) {
|
|
|
14f8ab |
@@ -2259,7 +2258,8 @@ out:
|
|
|
14f8ab |
if (op_errstr)
|
|
|
14f8ab |
*op_errstr = errstr;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+ if (!op_errstr && errstr)
|
|
|
14f8ab |
+ GF_FREE(errstr);
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -2687,6 +2687,7 @@ glusterd_op_remove_brick(dict_t *dict, char **op_errstr)
|
|
|
14f8ab |
* Update defrag_cmd as well or it will only be done
|
|
|
14f8ab |
* for nodes on which the brick to be removed exists.
|
|
|
14f8ab |
*/
|
|
|
14f8ab |
+ /* coverity[MIXED_ENUMS] */
|
|
|
14f8ab |
volinfo->rebal.defrag_cmd = cmd;
|
|
|
14f8ab |
volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED;
|
|
|
14f8ab |
ret = dict_get_strn(dict, GF_REMOVE_BRICK_TID_KEY,
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
14f8ab |
index 85c06c1..5a91df4 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
14f8ab |
@@ -4107,6 +4107,7 @@ gd_pause_or_resume_gsync(dict_t *dict, char *master, char *slave,
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
sys_close(pfd);
|
|
|
14f8ab |
+ /* coverity[INTEGER_OVERFLOW] */
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -4183,7 +4184,7 @@ stop_gsync(char *master, char *slave, char **msg, char *conf_path,
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
sys_close(pfd);
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+ /* coverity[INTEGER_OVERFLOW] */
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
|
|
|
14f8ab |
index 67e3f41..e338bf4 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
|
|
|
14f8ab |
@@ -111,7 +111,7 @@ glusterd_svc_get_gfproxyd_volfile(glusterd_volinfo_t *volinfo, char *svc_name,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
+ /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
tmp_fd = mkstemp(*tmpvol);
|
|
|
14f8ab |
if (tmp_fd < 0) {
|
|
|
14f8ab |
gf_msg("glusterd", GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
14f8ab |
index 2e73c98..1f31e72 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
14f8ab |
@@ -930,6 +930,7 @@ __glusterd_handle_cluster_lock(rpcsvc_request_t *req)
|
|
|
14f8ab |
|
|
|
14f8ab |
op_ctx = dict_new();
|
|
|
14f8ab |
if (!op_ctx) {
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_DICT_CREATE_FAIL,
|
|
|
14f8ab |
"Unable to set new dict");
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
@@ -956,6 +957,9 @@ out:
|
|
|
14f8ab |
glusterd_friend_sm();
|
|
|
14f8ab |
glusterd_op_sm();
|
|
|
14f8ab |
|
|
|
14f8ab |
+ if (ret)
|
|
|
14f8ab |
+ GF_FREE(ctx);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -3470,6 +3474,7 @@ glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options,
|
|
|
14f8ab |
GF_ASSERT(this);
|
|
|
14f8ab |
|
|
|
14f8ab |
GF_ASSERT(options);
|
|
|
14f8ab |
+ GF_VALIDATE_OR_GOTO(this->name, rpc, out);
|
|
|
14f8ab |
|
|
|
14f8ab |
if (force && rpc && *rpc) {
|
|
|
14f8ab |
(void)rpc_clnt_unref(*rpc);
|
|
|
14f8ab |
@@ -3482,7 +3487,6 @@ glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
|
|
|
14f8ab |
ret = rpc_clnt_register_notify(new_rpc, notify_fn, notify_data);
|
|
|
14f8ab |
- *rpc = new_rpc;
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
ret = rpc_clnt_start(new_rpc);
|
|
|
14f8ab |
@@ -3491,6 +3495,8 @@ out:
|
|
|
14f8ab |
if (new_rpc) {
|
|
|
14f8ab |
(void)rpc_clnt_unref(new_rpc);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ *rpc = new_rpc;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
gf_msg_debug(this->name, 0, "returning %d", ret);
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
|
|
|
14f8ab |
index 332ddef..c017ccb 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
|
|
|
14f8ab |
@@ -334,7 +334,10 @@ make_ghadoop_mountspec(gf_mount_spec_t *mspec, const char *volname, char *user,
|
|
|
14f8ab |
if (ret == -1)
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
|
|
|
14f8ab |
- return parse_mount_pattern_desc(mspec, hadoop_mnt_desc);
|
|
|
14f8ab |
+ ret = parse_mount_pattern_desc(mspec, hadoop_mnt_desc);
|
|
|
14f8ab |
+ GF_FREE(hadoop_mnt_desc);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
static gf_boolean_t
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
14f8ab |
index 6475611..46fc607 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
14f8ab |
@@ -2467,6 +2467,7 @@ glusterd_start_bricks(glusterd_volinfo_t *volinfo)
|
|
|
14f8ab |
if (!brickinfo->start_triggered) {
|
|
|
14f8ab |
pthread_mutex_lock(&brickinfo->restart_mutex);
|
|
|
14f8ab |
{
|
|
|
14f8ab |
+ /* coverity[SLEEP] */
|
|
|
14f8ab |
ret = glusterd_brick_start(volinfo, brickinfo, _gf_false,
|
|
|
14f8ab |
_gf_false);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
@@ -3466,6 +3467,7 @@ _add_task_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo, int op, int index)
|
|
|
14f8ab |
|
|
|
14f8ab |
switch (op) {
|
|
|
14f8ab |
case GD_OP_REMOVE_TIER_BRICK:
|
|
|
14f8ab |
+ /* Fall through */
|
|
|
14f8ab |
case GD_OP_REMOVE_BRICK:
|
|
|
14f8ab |
snprintf(key, sizeof(key), "task%d", index);
|
|
|
14f8ab |
ret = _add_remove_bricks_to_dict(dict, volinfo, key);
|
|
|
14f8ab |
@@ -7550,6 +7552,7 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
|
|
|
14f8ab |
glusterd_op_t op = GD_OP_NONE;
|
|
|
14f8ab |
glusterd_req_ctx_t *req_ctx = NULL;
|
|
|
14f8ab |
char *op_errstr = NULL;
|
|
|
14f8ab |
+ gf_boolean_t free_req_ctx = _gf_false;
|
|
|
14f8ab |
|
|
|
14f8ab |
this = THIS;
|
|
|
14f8ab |
priv = this->private;
|
|
|
14f8ab |
@@ -7558,6 +7561,9 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
|
|
|
14f8ab |
req_ctx = ctx;
|
|
|
14f8ab |
} else {
|
|
|
14f8ab |
req_ctx = GF_CALLOC(1, sizeof(*req_ctx), gf_gld_mt_op_allack_ctx_t);
|
|
|
14f8ab |
+ if (!req_ctx)
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ free_req_ctx = _gf_true;
|
|
|
14f8ab |
op = glusterd_op_get_op();
|
|
|
14f8ab |
req_ctx->op = op;
|
|
|
14f8ab |
gf_uuid_copy(req_ctx->uuid, MY_UUID);
|
|
|
14f8ab |
@@ -7588,6 +7594,8 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
+ if (ret && req_ctx && free_req_ctx)
|
|
|
14f8ab |
+ GF_FREE(req_ctx);
|
|
|
14f8ab |
gf_msg_debug(this->name, 0, "Returning with %d", ret);
|
|
|
14f8ab |
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
14f8ab |
index 8c1feeb..1a65359 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
14f8ab |
@@ -82,6 +82,7 @@ glusterd_peerinfo_cleanup(glusterd_peerinfo_t *peerinfo)
|
|
|
14f8ab |
call_rcu(&peerinfo->rcu_head.head, glusterd_peerinfo_destroy);
|
|
|
14f8ab |
|
|
|
14f8ab |
if (quorum_action)
|
|
|
14f8ab |
+ /* coverity[SLEEP] */
|
|
|
14f8ab |
glusterd_do_quorum_action();
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
@@ -358,6 +359,7 @@ glusterd_uuid_to_hostname(uuid_t uuid)
|
|
|
14f8ab |
|
|
|
14f8ab |
if (!gf_uuid_compare(MY_UUID, uuid)) {
|
|
|
14f8ab |
hostname = gf_strdup("localhost");
|
|
|
14f8ab |
+ return hostname;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
RCU_READ_LOCK;
|
|
|
14f8ab |
if (!cds_list_empty(&priv->peers)) {
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
14f8ab |
index fd334e6..f378187 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
14f8ab |
@@ -372,6 +372,7 @@ glusterd_do_volume_quorum_action(xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
14f8ab |
if (!brickinfo->start_triggered) {
|
|
|
14f8ab |
pthread_mutex_lock(&brickinfo->restart_mutex);
|
|
|
14f8ab |
{
|
|
|
14f8ab |
+ /* coverity[SLEEP] */
|
|
|
14f8ab |
ret = glusterd_brick_start(volinfo, brickinfo, _gf_false,
|
|
|
14f8ab |
_gf_false);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
14f8ab |
index b3b5ee9..4fa8116 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
14f8ab |
@@ -4764,10 +4764,6 @@ glusterd_store_retrieve_peers(xlator_t *this)
|
|
|
14f8ab |
*/
|
|
|
14f8ab |
address = cds_list_entry(peerinfo->hostnames.next,
|
|
|
14f8ab |
glusterd_peer_hostname_t, hostname_list);
|
|
|
14f8ab |
- if (!address) {
|
|
|
14f8ab |
- ret = -1;
|
|
|
14f8ab |
- goto next;
|
|
|
14f8ab |
- }
|
|
|
14f8ab |
peerinfo->hostname = gf_strdup(address->hostname);
|
|
|
14f8ab |
|
|
|
14f8ab |
ret = glusterd_friend_add_from_peerinfo(peerinfo, 1, NULL);
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
14f8ab |
index ca19a75..1d1f42d 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
14f8ab |
@@ -179,7 +179,7 @@ glusterd_svc_check_volfile_identical(char *svc_name,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
+ /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
tmp_fd = mkstemp(tmpvol);
|
|
|
14f8ab |
if (tmp_fd < 0) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
14f8ab |
@@ -241,7 +241,7 @@ glusterd_svc_check_topology_identical(char *svc_name,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
+ /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
tmpfd = mkstemp(tmpvol);
|
|
|
14f8ab |
if (tmpfd < 0) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
14f8ab |
index 618d8bc..9e47d14 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
14f8ab |
@@ -1752,6 +1752,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
|
|
|
14f8ab |
if (dict_get(op_ctx, "client-count"))
|
|
|
14f8ab |
break;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ /* coverity[MIXED_ENUMS] */
|
|
|
14f8ab |
} else if (cmd == GF_OP_CMD_DETACH_START) {
|
|
|
14f8ab |
op = GD_OP_REMOVE_BRICK;
|
|
|
14f8ab |
dict_del(req_dict, "rebalance-command");
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
|
|
|
14f8ab |
index 922eae7..59843a0 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
|
|
|
14f8ab |
@@ -116,7 +116,7 @@ glusterd_svc_check_tier_volfile_identical(char *svc_name,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
+ /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
tmp_fd = mkstemp(tmpvol);
|
|
|
14f8ab |
if (tmp_fd < 0) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
14f8ab |
@@ -177,7 +177,7 @@ glusterd_svc_check_tier_topology_identical(char *svc_name,
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
+ /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
|
|
|
14f8ab |
tmpfd = mkstemp(tmpvol);
|
|
|
14f8ab |
if (tmpfd < 0) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
index 14e23d1..8b0fc9a 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
@@ -908,6 +908,7 @@ glusterd_create_sub_tier_volinfo(glusterd_volinfo_t *volinfo,
|
|
|
14f8ab |
(*dup_volinfo)->brick_count = tier_info->cold_brick_count;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
+ /* coverity[REVERSE_NULL] */
|
|
|
14f8ab |
if (ret && *dup_volinfo) {
|
|
|
14f8ab |
glusterd_volinfo_delete(*dup_volinfo);
|
|
|
14f8ab |
*dup_volinfo = NULL;
|
|
|
14f8ab |
@@ -2738,6 +2739,7 @@ glusterd_readin_file(const char *filepath, int *line_count)
|
|
|
14f8ab |
/* Reduce allocation to minimal size. */
|
|
|
14f8ab |
p = GF_REALLOC(lines, (counter + 1) * sizeof(char *));
|
|
|
14f8ab |
if (!p) {
|
|
|
14f8ab |
+ /* coverity[TAINTED_SCALAR] */
|
|
|
14f8ab |
free_lines(lines, counter);
|
|
|
14f8ab |
lines = NULL;
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
@@ -6782,6 +6784,7 @@ glusterd_restart_bricks(void *opaque)
|
|
|
14f8ab |
if (!brickinfo->start_triggered) {
|
|
|
14f8ab |
pthread_mutex_lock(&brickinfo->restart_mutex);
|
|
|
14f8ab |
{
|
|
|
14f8ab |
+ /* coverity[SLEEP] */
|
|
|
14f8ab |
glusterd_brick_start(volinfo, brickinfo, _gf_false,
|
|
|
14f8ab |
_gf_false);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
@@ -8886,7 +8889,7 @@ glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr)
|
|
|
14f8ab |
kill(pid, SIGUSR1);
|
|
|
14f8ab |
|
|
|
14f8ab |
sleep(1);
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+ /* coverity[TAINTED_STRING] */
|
|
|
14f8ab |
sys_unlink(dumpoptions_path);
|
|
|
14f8ab |
ret = 0;
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
@@ -9012,6 +9015,7 @@ glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr)
|
|
|
14f8ab |
|
|
|
14f8ab |
sleep(1);
|
|
|
14f8ab |
|
|
|
14f8ab |
+ /* coverity[TAINTED_STRING] */
|
|
|
14f8ab |
sys_unlink(dumpoptions_path);
|
|
|
14f8ab |
ret = 0;
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
@@ -13423,7 +13427,7 @@ glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *ctx,
|
|
|
14f8ab |
if (key_fixed)
|
|
|
14f8ab |
key = key_fixed;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
-
|
|
|
14f8ab |
+ /* coverity[CONSTANT_EXPRESSION_RESULT] */
|
|
|
14f8ab |
ALL_VOLUME_OPTION_CHECK("all", _gf_true, key, ret, op_errstr, out);
|
|
|
14f8ab |
|
|
|
14f8ab |
for (i = 0; valid_all_vol_opts[i].option; i++) {
|
|
|
14f8ab |
@@ -14153,6 +14157,7 @@ glusterd_disallow_op_for_tier(glusterd_volinfo_t *volinfo, glusterd_op_t op,
|
|
|
14f8ab |
break;
|
|
|
14f8ab |
case GD_OP_REMOVE_BRICK:
|
|
|
14f8ab |
switch (cmd) {
|
|
|
14f8ab |
+ /* coverity[MIXED_ENUMS] */
|
|
|
14f8ab |
case GF_DEFRAG_CMD_DETACH_START:
|
|
|
14f8ab |
case GF_OP_CMD_DETACH_COMMIT_FORCE:
|
|
|
14f8ab |
case GF_OP_CMD_DETACH_COMMIT:
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
index 539e8a5..6852f8e 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
14f8ab |
@@ -322,7 +322,7 @@ volopt_trie_cbk(char *word, void *param)
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
static int
|
|
|
14f8ab |
-process_nodevec(struct trienodevec *nodevec, char **hint)
|
|
|
14f8ab |
+process_nodevec(struct trienodevec *nodevec, char **outputhint, char *inputhint)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
int ret = 0;
|
|
|
14f8ab |
char *hint1 = NULL;
|
|
|
14f8ab |
@@ -331,14 +331,14 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
|
|
|
14f8ab |
trienode_t **nodes = nodevec->nodes;
|
|
|
14f8ab |
|
|
|
14f8ab |
if (!nodes[0]) {
|
|
|
14f8ab |
- *hint = NULL;
|
|
|
14f8ab |
+ *outputhint = NULL;
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
#if 0
|
|
|
14f8ab |
/* Limit as in git */
|
|
|
14f8ab |
if (trienode_get_dist (nodes[0]) >= 6) {
|
|
|
14f8ab |
- *hint = NULL;
|
|
|
14f8ab |
+ *outputhint = NULL;
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
#endif
|
|
|
14f8ab |
@@ -347,23 +347,30 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
|
|
|
14f8ab |
return -1;
|
|
|
14f8ab |
|
|
|
14f8ab |
if (nodevec->cnt < 2 || !nodes[1]) {
|
|
|
14f8ab |
- *hint = hint1;
|
|
|
14f8ab |
+ *outputhint = hint1;
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- if (trienode_get_word(nodes[1], &hint2))
|
|
|
14f8ab |
+ if (trienode_get_word(nodes[1], &hint2)) {
|
|
|
14f8ab |
+ GF_FREE(hint1);
|
|
|
14f8ab |
return -1;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
|
|
|
14f8ab |
- if (*hint)
|
|
|
14f8ab |
- hintinfx = *hint;
|
|
|
14f8ab |
- ret = gf_asprintf(hint, "%s or %s%s", hint1, hintinfx, hint2);
|
|
|
14f8ab |
+ if (inputhint)
|
|
|
14f8ab |
+ hintinfx = inputhint;
|
|
|
14f8ab |
+ ret = gf_asprintf(outputhint, "%s or %s%s", hint1, hintinfx, hint2);
|
|
|
14f8ab |
if (ret > 0)
|
|
|
14f8ab |
ret = 0;
|
|
|
14f8ab |
+ if (hint1)
|
|
|
14f8ab |
+ GF_FREE(hint1);
|
|
|
14f8ab |
+ if (hint2)
|
|
|
14f8ab |
+ GF_FREE(hint2);
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
static int
|
|
|
14f8ab |
-volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
|
|
|
14f8ab |
+volopt_trie_section(int lvl, char **patt, char *word, char **outputhint,
|
|
|
14f8ab |
+ char *inputhint, int hints)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
trienode_t *nodes[] = {NULL, NULL};
|
|
|
14f8ab |
struct trienodevec nodevec = {nodes, 2};
|
|
|
14f8ab |
@@ -384,7 +391,7 @@ volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
|
|
|
14f8ab |
nodevec.cnt = hints;
|
|
|
14f8ab |
ret = trie_measure_vec(trie, word, &nodevec);
|
|
|
14f8ab |
if (!ret && nodevec.nodes[0])
|
|
|
14f8ab |
- ret = process_nodevec(&nodevec, hint);
|
|
|
14f8ab |
+ ret = process_nodevec(&nodevec, outputhint, inputhint);
|
|
|
14f8ab |
|
|
|
14f8ab |
trie_destroy(trie);
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -396,6 +403,7 @@ volopt_trie(char *key, char **hint)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
char *patt[] = {NULL};
|
|
|
14f8ab |
char *fullhint = NULL;
|
|
|
14f8ab |
+ char *inputhint = NULL;
|
|
|
14f8ab |
char *dot = NULL;
|
|
|
14f8ab |
char *dom = NULL;
|
|
|
14f8ab |
int len = 0;
|
|
|
14f8ab |
@@ -405,7 +413,7 @@ volopt_trie(char *key, char **hint)
|
|
|
14f8ab |
|
|
|
14f8ab |
dot = strchr(key, '.');
|
|
|
14f8ab |
if (!dot)
|
|
|
14f8ab |
- return volopt_trie_section(1, patt, key, hint, 2);
|
|
|
14f8ab |
+ return volopt_trie_section(1, patt, key, hint, inputhint, 2);
|
|
|
14f8ab |
|
|
|
14f8ab |
len = dot - key;
|
|
|
14f8ab |
dom = gf_strdup(key);
|
|
|
14f8ab |
@@ -413,7 +421,7 @@ volopt_trie(char *key, char **hint)
|
|
|
14f8ab |
return -1;
|
|
|
14f8ab |
dom[len] = '\0';
|
|
|
14f8ab |
|
|
|
14f8ab |
- ret = volopt_trie_section(0, NULL, dom, patt, 1);
|
|
|
14f8ab |
+ ret = volopt_trie_section(0, NULL, dom, patt, inputhint, 1);
|
|
|
14f8ab |
GF_FREE(dom);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
patt[0] = NULL;
|
|
|
14f8ab |
@@ -422,8 +430,8 @@ volopt_trie(char *key, char **hint)
|
|
|
14f8ab |
if (!patt[0])
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
|
|
|
14f8ab |
- *hint = "...";
|
|
|
14f8ab |
- ret = volopt_trie_section(1, patt, dot + 1, hint, 2);
|
|
|
14f8ab |
+ inputhint = "...";
|
|
|
14f8ab |
+ ret = volopt_trie_section(1, patt, dot + 1, hint, inputhint, 2);
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
if (*hint) {
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|