|
|
190130 |
From 179213798496448316547506da65dbd9fd741dfa Mon Sep 17 00:00:00 2001
|
|
|
190130 |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
190130 |
Date: Wed, 24 Apr 2019 22:02:51 +0530
|
|
|
190130 |
Subject: [PATCH 436/449] glusterd: coverity fixes
|
|
|
190130 |
|
|
|
190130 |
Addresses the following:
|
|
|
190130 |
|
|
|
190130 |
* CID 1124776: Resource leaks (RESOURCE_LEAK) - Variable "aa" going out
|
|
|
190130 |
of scope leaks the storage it points to in glusterd-volgen.c
|
|
|
190130 |
|
|
|
190130 |
* Bunch of CHECKED_RETURN defects in the callers of synctask_barrier_init
|
|
|
190130 |
|
|
|
190130 |
* CID 1400742: Program hangs (LOCK) - adding annotation to fix this
|
|
|
190130 |
false positive
|
|
|
190130 |
|
|
|
190130 |
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22615
|
|
|
190130 |
> Updates: bz#789278
|
|
|
190130 |
> Change-Id: I02f16e7eeb8c5cf72f7d0b29d00df4f03b3718b3
|
|
|
190130 |
> Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
190130 |
|
|
|
190130 |
BUG: 1787310
|
|
|
190130 |
Change-Id: I02f16e7eeb8c5cf72f7d0b29d00df4f03b3718b3
|
|
|
190130 |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
190130 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202626
|
|
|
190130 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
190130 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
190130 |
---
|
|
|
190130 |
xlators/mgmt/glusterd/src/glusterd-handler.c | 6 ++++++
|
|
|
190130 |
xlators/mgmt/glusterd/src/glusterd-mgmt.c | 24 +++++++++++++++++++-----
|
|
|
190130 |
xlators/mgmt/glusterd/src/glusterd-syncop.c | 22 ++++++++++++++++++----
|
|
|
190130 |
xlators/mgmt/glusterd/src/glusterd-volgen.c | 5 +++--
|
|
|
190130 |
4 files changed, 46 insertions(+), 11 deletions(-)
|
|
|
190130 |
|
|
|
190130 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
190130 |
index 1f31e72..b8799ab 100644
|
|
|
190130 |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
190130 |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
190130 |
@@ -3458,6 +3458,12 @@ glusterd_friend_remove(uuid_t uuid, char *hostname)
|
|
|
190130 |
ret = glusterd_peerinfo_cleanup(peerinfo);
|
|
|
190130 |
out:
|
|
|
190130 |
gf_msg_debug(THIS->name, 0, "returning %d", ret);
|
|
|
190130 |
+ /* We don't need to do a mutex unlock of peerinfo->delete_lock as the same
|
|
|
190130 |
+ * will be anyway destroyed within glusterd_peerinfo_cleanup, coverity
|
|
|
190130 |
+ * though cries about it
|
|
|
190130 |
+ */
|
|
|
190130 |
+ /* coverity[LOCK] */
|
|
|
190130 |
+
|
|
|
190130 |
return ret;
|
|
|
190130 |
}
|
|
|
190130 |
|
|
|
190130 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
190130 |
index a4915f3..1e185d7 100644
|
|
|
190130 |
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
190130 |
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
|
|
|
190130 |
@@ -757,7 +757,10 @@ glusterd_mgmt_v3_initiate_lockdown(glusterd_op_t op, dict_t *dict,
|
|
|
190130 |
|
|
|
190130 |
/* Sending mgmt_v3 lock req to other nodes in the cluster */
|
|
|
190130 |
gd_syncargs_init(&args, NULL);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1108,7 +1111,10 @@ glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict,
|
|
|
190130 |
|
|
|
190130 |
/* Sending Pre Validation req to other nodes in the cluster */
|
|
|
190130 |
gd_syncargs_init(&args, req_dict);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1458,7 +1464,10 @@ glusterd_mgmt_v3_brick_op(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
|
|
|
190130 |
|
|
|
190130 |
/* Sending brick op req to other nodes in the cluster */
|
|
|
190130 |
gd_syncargs_init(&args, op_ctx);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1722,7 +1731,9 @@ glusterd_mgmt_v3_commit(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
|
|
|
190130 |
|
|
|
190130 |
/* Sending commit req to other nodes in the cluster */
|
|
|
190130 |
gd_syncargs_init(&args, op_ctx);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1963,7 +1974,10 @@ glusterd_mgmt_v3_post_validate(glusterd_op_t op, int32_t op_ret, dict_t *dict,
|
|
|
190130 |
|
|
|
190130 |
/* Sending Post Validation req to other nodes in the cluster */
|
|
|
190130 |
gd_syncargs_init(&args, req_dict);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
190130 |
index 9e47d14..c78983a 100644
|
|
|
190130 |
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
190130 |
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
190130 |
@@ -1191,7 +1191,12 @@ gd_lock_op_phase(glusterd_conf_t *conf, glusterd_op_t op, dict_t *op_ctx,
|
|
|
190130 |
struct syncargs args = {0};
|
|
|
190130 |
|
|
|
190130 |
this = THIS;
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ GF_VALIDATE_OR_GOTO("glusterd", this, out);
|
|
|
190130 |
+
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1321,7 +1326,10 @@ stage_done:
|
|
|
190130 |
}
|
|
|
190130 |
|
|
|
190130 |
gd_syncargs_init(&args, aggr_dict);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
RCU_READ_LOCK;
|
|
|
190130 |
@@ -1449,7 +1457,10 @@ commit_done:
|
|
|
190130 |
}
|
|
|
190130 |
|
|
|
190130 |
gd_syncargs_init(&args, op_ctx);
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
origin_glusterd = is_origin_glusterd(req_dict);
|
|
|
190130 |
|
|
|
190130 |
@@ -1541,7 +1552,10 @@ gd_unlock_op_phase(glusterd_conf_t *conf, glusterd_op_t op, int *op_ret,
|
|
|
190130 |
goto out;
|
|
|
190130 |
}
|
|
|
190130 |
|
|
|
190130 |
- synctask_barrier_init((&args));
|
|
|
190130 |
+ ret = synctask_barrier_init((&args));
|
|
|
190130 |
+ if (ret)
|
|
|
190130 |
+ goto out;
|
|
|
190130 |
+
|
|
|
190130 |
peer_cnt = 0;
|
|
|
190130 |
|
|
|
190130 |
if (cluster_lock) {
|
|
|
190130 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
190130 |
index 6852f8e..16346e7 100644
|
|
|
190130 |
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
190130 |
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
|
|
190130 |
@@ -4808,9 +4808,10 @@ nfs_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme,
|
|
|
190130 |
|
|
|
190130 |
if (ret != -1) {
|
|
|
190130 |
ret = gf_canonicalize_path(vme->value);
|
|
|
190130 |
- if (ret)
|
|
|
190130 |
+ if (ret) {
|
|
|
190130 |
+ GF_FREE(aa);
|
|
|
190130 |
return -1;
|
|
|
190130 |
-
|
|
|
190130 |
+ }
|
|
|
190130 |
ret = xlator_set_option(xl, aa, ret, vme->value);
|
|
|
190130 |
GF_FREE(aa);
|
|
|
190130 |
}
|
|
|
190130 |
--
|
|
|
190130 |
1.8.3.1
|
|
|
190130 |
|