1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
From 469cb9e16d46f075caf609ddcb12a7c02d73ce8b Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Thu, 11 Jul 2019 12:50:24 +0530
Subject: [PATCH 248/255] Revert "shd/mux: Fix coverity issues introduced by
shd mux patch"
This reverts commit 0021a4bbc9af2bfe28d4a79f76c3cd33f23dd118.
BUG: 1471742
Change-Id: I0749328412ed3cc7ae5d64baea7a90b63b489a08
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/175957
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
libglusterfs/src/graph.c | 21 ++++++++-------------
xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 6 ------
xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 24 +++++++-----------------
3 files changed, 15 insertions(+), 36 deletions(-)
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
index 4c8b02d..a492dd8 100644
--- a/libglusterfs/src/graph.c
+++ b/libglusterfs/src/graph.c
@@ -1470,9 +1470,7 @@ glusterfs_process_svc_detach(glusterfs_ctx_t *ctx, gf_volfile_t *volfile_obj)
goto out;
parent_graph = ctx->active;
graph = volfile_obj->graph;
- if (!graph)
- goto out;
- if (graph->first)
+ if (graph && graph->first)
xl = graph->first;
last_xl = graph->last_xl;
@@ -1593,10 +1591,12 @@ glusterfs_process_svc_attach_volfp(glusterfs_ctx_t *ctx, FILE *fp,
parent_graph->leaf_count += graph->leaf_count;
parent_graph->id++;
- volfile_obj = GF_CALLOC(1, sizeof(gf_volfile_t), gf_common_volfile_t);
if (!volfile_obj) {
- ret = -1;
- goto out;
+ volfile_obj = GF_CALLOC(1, sizeof(gf_volfile_t), gf_common_volfile_t);
+ if (!volfile_obj) {
+ ret = -1;
+ goto out;
+ }
}
graph->used = 1;
@@ -1641,7 +1641,6 @@ glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
{
glusterfs_graph_t *oldvolfile_graph = NULL;
glusterfs_graph_t *newvolfile_graph = NULL;
- char vol_id[NAME_MAX + 1];
int ret = -1;
@@ -1673,9 +1672,6 @@ glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
glusterfs_graph_prepare(newvolfile_graph, ctx, newvolfile_graph->first);
if (!is_graph_topology_equal(oldvolfile_graph, newvolfile_graph)) {
- ret = snprintf(vol_id, sizeof(vol_id), "%s", volfile_obj->vol_id);
- if (ret < 0)
- goto out;
ret = glusterfs_process_svc_detach(ctx, volfile_obj);
if (ret) {
gf_msg("glusterfsd-mgmt", GF_LOG_ERROR, EINVAL,
@@ -1684,9 +1680,8 @@ glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
"old graph. Aborting the reconfiguration operation");
goto out;
}
- volfile_obj = NULL;
- ret = glusterfs_process_svc_attach_volfp(ctx, newvolfile_fp, vol_id,
- checksum);
+ ret = glusterfs_process_svc_attach_volfp(ctx, newvolfile_fp,
+ volfile_obj->vol_id, checksum);
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
index 19eca9f..4789843 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
@@ -101,8 +101,6 @@ glusterd_shdsvc_init(void *data, glusterd_conn_t *mux_conn,
svc->conn.rpc = rpc_clnt_ref(mux_svc->rpc);
ret = snprintf(svc->conn.sockpath, sizeof(svc->conn.sockpath), "%s",
mux_conn->sockpath);
- if (ret < 0)
- goto out;
} else {
ret = mkdir_p(logdir, 0755, _gf_true);
if ((ret == -1) && (EEXIST != errno)) {
@@ -675,10 +673,6 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig)
glusterd_volinfo_ref(volinfo);
svc_proc->data = volinfo;
ret = glusterd_svc_stop(svc, sig);
- if (ret) {
- glusterd_volinfo_unref(volinfo);
- goto out;
- }
}
if (!empty && pid != -1) {
ret = glusterd_detach_svc(svc, volinfo, sig);
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index 02945b1..e42703c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -411,14 +411,9 @@ __gf_find_compatible_svc(gd_node_type daemon)
conf = THIS->private;
GF_VALIDATE_OR_GOTO("glusterd", conf, out);
- switch (daemon) {
- case GD_NODE_SHD: {
- svc_procs = &conf->shd_procs;
- if (!svc_procs)
- goto out;
- } break;
- default:
- /* Add support for other client daemons here */
+ if (daemon == GD_NODE_SHD) {
+ svc_procs = &conf->shd_procs;
+ if (!svc_procs)
goto out;
}
@@ -545,16 +540,11 @@ __gf_find_compatible_svc_from_pid(gd_node_type daemon, pid_t pid)
if (!conf)
return NULL;
- switch (daemon) {
- case GD_NODE_SHD: {
- svc_procs = &conf->shd_procs;
- if (!svc_procs)
- return NULL;
- } break;
- default:
- /* Add support for other client daemons here */
+ if (daemon == GD_NODE_SHD) {
+ svc_procs = &conf->shd_procs;
+ if (!svc_proc)
return NULL;
- }
+ } /* Can be moved to switch when mux is implemented for other daemon; */
cds_list_for_each_entry(svc_proc, svc_procs, svc_proc_list)
{
--
1.8.3.1
|