From c6bfde4da5da40f81ab7d96f4d43adb2553a633d Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 24 Feb 2015 16:36:05 +0530 Subject: cluster/dht: create request dictionary if necessary during refresh layout. Change-Id: I5a5d793c86ee5de345608eede5618e4e6c02af9f BUG: 1195668 Signed-off-by: Raghavendra G Reviewed-on: http://review.gluster.org/9733 --- xlators/cluster/dht/src/dht-selfheal.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (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 50c2805d51b..727b2d6027d 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -260,6 +260,13 @@ dht_refresh_layout (call_frame_t *frame) dict_del (local->xattr, conf->xattr_name); } + if (local->xattr_req == NULL) { + local->xattr_req = dict_new (); + if (local->xattr_req == NULL) { + goto out; + } + } + if (dict_get (local->xattr_req, conf->xattr_name) == 0) { ret = dict_set_uint32 (local->xattr_req, conf->xattr_name, 4 * 4); @@ -440,14 +447,14 @@ gf_boolean_t dht_should_fix_layout (call_frame_t *frame, dht_layout_t **inmem, dht_layout_t **ondisk) { - gf_boolean_t fixit = _gf_true; - dht_local_t *local = NULL; - int layout_span = 0; - int ondisk_decommissioned_bricks = 0; - int ret = 0; - dht_conf_t *conf = NULL; - dht_distribution_type_t inmem_dist_type = 0; - dht_distribution_type_t ondisk_dist_type = 0; + gf_boolean_t fixit = _gf_true; + dht_local_t *local = NULL; + int layout_span = 0; + int decommissioned_bricks = 0; + int ret = 0; + dht_conf_t *conf = NULL; + dht_distribution_type_t inmem_dist_type = 0; + dht_distribution_type_t ondisk_dist_type = 0; conf = frame->this->private; @@ -477,13 +484,13 @@ dht_should_fix_layout (call_frame_t *frame, dht_layout_t **inmem, layout_span = dht_layout_span (*ondisk); - ondisk_decommissioned_bricks + decommissioned_bricks = dht_decommissioned_bricks_in_layout (frame->this, *ondisk); inmem_dist_type = dht_distribution_type (frame->this, *inmem); ondisk_dist_type = dht_distribution_type (frame->this, *ondisk); - if ((ondisk_decommissioned_bricks == 0) + if ((decommissioned_bricks == 0) && (layout_span == (conf->subvolume_cnt - conf->decommission_subvols_cnt)) && (inmem_dist_type == ondisk_dist_type)) -- cgit