diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2017-11-03 16:54:55 +0530 |
---|---|---|
committer | mohammed rafi kc <rkavunga@redhat.com> | 2017-11-09 11:31:40 +0000 |
commit | 9eea263043e86ebd79ae72cc79ce4c22f336f958 (patch) | |
tree | 4444ccb1eb97199b79b3637ad28513b416e4c1d8 | |
parent | 2d258d818a05ef1b7456ee6cec263605af24deba (diff) |
snapshot: fix coverity issue 'UNREACHABLE'
Problem : In glusterd-snapshot-utils.c:2778 code path is unreachable as it was
intended for n-way replication snapshot support.
Fix : Removed code now, will revert back this change in future once we support
n-way replication in snapshot.
This patch fixes coverity issue 687 from [1].
[1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/
Change-Id: I163f318e62a7e84d211d9930dedee6587d37b2a0
BUG: 789278
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index a61ecab84d6..842fe7640f7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -2757,7 +2757,6 @@ glusterd_volume_quorum_calculate (glusterd_volinfo_t *volinfo, dict_t *dict, gf_boolean_t quorum_met = _gf_false; char err_str[PATH_MAX] = {0, }; xlator_t *this = NULL; - int up_count = 0; this = THIS; GF_ASSERT (this); @@ -2781,43 +2780,11 @@ glusterd_volume_quorum_calculate (glusterd_volinfo_t *volinfo, dict_t *dict, GD_MSG_BRICK_DISCONNECTED, "%s", err_str); *op_errstr = gf_strdup (err_str); *op_errno = EG_BRCKDWN; - goto out; } else { quorum_met = _gf_true; - goto out; - } - - up_count = volinfo->dist_leaf_count - down_count; - - if (quorum_type && !strcmp (quorum_type, "fixed")) { - if (up_count >= quorum_count) { - quorum_met = _gf_true; - goto out; - } - } else { - if ((GF_CLUSTER_TYPE_DISPERSE != volinfo->type) && - (volinfo->dist_leaf_count % 2 == 0)) { - if ((up_count > quorum_count) || - ((up_count == quorum_count) && first_brick_on)) { - quorum_met = _gf_true; - goto out; - } - } else { - if (up_count >= quorum_count) { - quorum_met = _gf_true; - goto out; - } - } - } - - if (!quorum_met) { - snprintf (err_str, sizeof (err_str), "quorum is not met"); - gf_msg (this->name, GF_LOG_WARNING, 0, - GD_MSG_SERVER_QUORUM_NOT_MET, "%s", err_str); - *op_errstr = gf_strdup (err_str); - *op_errno = EG_BRCKDWN; } + /* TODO : Support for n-way relication in snapshot*/ out: return quorum_met; } |