summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNikhil Ladha <nladha@redhat.com>2021-04-19 13:55:16 +0530
committerGitHub <noreply@github.com>2021-04-19 10:25:16 +0200
commit7602b74b71897e5b3d07cbcd66a36dba511345b5 (patch)
tree95a0b614cd3fba22190778af4461d3f26cc306dd /xlators
parent6dbb5e312a2fd9a59197bb4155d9fb69a8825239 (diff)
downloadglusterfs-7602b74b71897e5b3d07cbcd66a36dba511345b5.tar.gz
glusterfs-7602b74b71897e5b3d07cbcd66a36dba511345b5.tar.xz
glusterfs-7602b74b71897e5b3d07cbcd66a36dba511345b5.zip
coverity: Removed structural dead code (#2320)
Issue: `for` loop was executed only once, leading to structural dead code in coverity Fix: Updated the code to use `if` condition instead of `for` loop for the same. CID: 1437779 Updates: #1060 Change-Id: I2ca1d2c9d2842d586161fe971bb8c7b3444dfb2b Signed-off-by: nik-redhat <nladha@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/server/src/server.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 91f68cbb99..30acc9bf93 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -637,7 +637,6 @@ server_graph_janitor_threads(void *data)
xlator_list_t **trav_p = NULL;
xlator_t *top = NULL;
uint32_t parent_down = 0;
- uint32_t totchildcount = 1;
struct rpc_clnt *rpc = NULL;
GF_ASSERT(data);
@@ -684,12 +683,7 @@ server_graph_janitor_threads(void *data)
xlator_mem_cleanup(victim);
LOCK(&ctx->volfile_lock);
{
- totchildcount = 0;
- for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) {
- totchildcount++;
- break;
- }
- if (!totchildcount && !ctx->destroy_ctx) {
+ if (!top->children && !ctx->destroy_ctx) {
ctx->destroy_ctx = _gf_true;
destroy_ctx = _gf_true;
}
@@ -701,7 +695,7 @@ server_graph_janitor_threads(void *data)
out:
free(arg->victim_name);
free(arg);
- if (!totchildcount && destroy_ctx) {
+ if (destroy_ctx) {
gf_log(THIS->name, GF_LOG_INFO,
"Going to Cleanup ctx pool memory and exit the process %s",
ctx->cmdlinestr);