From b922437795a68b32cd6fb337dfd66a4ead13b4ee Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 14 Jul 2011 16:17:57 +0530 Subject: cluster/distribute: while fixing layout, consider ENOSPC errors in case of layout 'creation', layout->err == ENOSPC should be ignored where as, while layout 'fixing' we should consider what was already present in the layout. Change-Id: Ifb613b41065813c9f1202e65e94b4b0282766d11 BUG: 2258 Signed-off-by: Amar Tumballi Reviewed-on: http://review.gluster.com/15 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda --- xlators/cluster/dht/src/dht-selfheal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 3d4f13c6f..8245cacdc 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -457,7 +457,7 @@ dht_selfheal_layout_alloc_start (xlator_t *this, loc_t *loc, } static inline int -dht_get_layout_count (xlator_t *this, dht_layout_t *layout) +dht_get_layout_count (xlator_t *this, dht_layout_t *layout, int new_layout) { int i = 0; int err = 0; @@ -472,7 +472,7 @@ dht_get_layout_count (xlator_t *this, dht_layout_t *layout) } /* no subvolume has enough space, but can't stop directory creation */ - if (!count) { + if (!count || !new_layout) { for (i = 0; i < layout->cnt; i++) { err = layout->list[i].err; if (err == ENOSPC) { @@ -516,7 +516,7 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc, priv = this->private; local = frame->local; - count = cnt = dht_get_layout_count (this, layout); + count = cnt = dht_get_layout_count (this, layout, 0); chunk = ((unsigned long) 0xffffffff) / ((cnt) ? cnt : 1); @@ -655,7 +655,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc, this = frame->this; - cnt = dht_get_layout_count (this, layout); + cnt = dht_get_layout_count (this, layout, 1); chunk = ((unsigned long) 0xffffffff) / ((cnt) ? cnt : 1); -- cgit