From f14d9bdd52b428466e7863d06c89b4684be3da07 Mon Sep 17 00:00:00 2001 From: Venkatesh Somyajulu Date: Mon, 22 Sep 2014 13:29:13 +0530 Subject: cluster/dht: Modified the calculation of brick_count Whenever new_layout is calculated for a directory, we calculate the number of childs of dht, who will get the actual(Non-zero) layout-range, and assign range to only those subvolume and other will get 0 as their layout->start and layout->stop value. This calculation is based on either a) weight_by_size or b) number of brick who will be assigned the non-zero range So if in case we are not assigning the layout based on weight_by_size, we should choose the "bricks_to_use" instead of "bricks_used". In regression test, we found that priv->du_stat[0].chunks was zero. In this case "bricks_used" variable will be zero, which will cause crash for chunk = ((unsigned long) 0xffffffff) / bricks__used; calculation. Change-Id: I6f1b21eff972a80d9eb22771087c1e2f53e7e724 BUG: 1143835 Signed-off-by: Venkatesh Somyajulu Reviewed-on: http://review.gluster.org/8792 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/cluster/dht/src/dht-selfheal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xlators/cluster/dht/src/dht-selfheal.c') diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index a92dba89d2b..2d12abe9747 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -1065,7 +1065,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc, total_size, chunk); } else { - chunk = ((unsigned long) 0xffffffff) / bricks_used; + chunk = ((unsigned long) 0xffffffff) / bricks_to_use; } start_subvol = dht_selfheal_layout_alloc_start (this, loc, layout); -- cgit