summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-02-03 15:21:51 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2015-03-05 10:32:32 -0800
commit8e1fb1ca03e252036b90490d5b7f390b5a9b4413 (patch)
treeb9bdacef3e273b15cc3d5406b94f7a77a9a16d28 /xlators
parente944ff1f5a187863343691dfc108237c10dde287 (diff)
xlators/dht : divide by zero coverity fix
CID:1226163. BUG: 789278 Change-Id: Ie31d65da236d7029784defad963672b2ded2676a BUG:1192435 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9563 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: N Balachandran <nbalacha@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index a6658cc4cbb..50c2805d51b 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -1572,7 +1572,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc,
}
}
- if (weight_by_size) {
+ if (weight_by_size && total_size) {
/* We know total_size is not zero. */
chunk = ((unsigned long) 0xffffffff) / total_size;
gf_log (this->name, GF_LOG_INFO,
@@ -1580,6 +1580,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc,
total_size, chunk);
}
else {
+ weight_by_size = _gf_false;
chunk = ((unsigned long) 0xffffffff) / bricks_to_use;
}