From 404e8f27d3a9e950173e02151eccbb792615e535 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 13 Mar 2012 13:54:11 +0530 Subject: distribute-rebalance: fix the logic of ENOENT handling due to this, we were missing the entries from the last subvolume of distribute for all the rebalance or remove-brick operations Change-Id: I486f15c1d3d17cbf6f353f6179b2623af61f4868 Signed-off-by: Amar Tumballi BUG: 770346 Reviewed-on: http://review.gluster.com/2933 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda --- xlators/cluster/dht/src/dht-rebalance.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/dht/src/dht-rebalance.c') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 0df20131a..eaf5e89ce 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1058,6 +1058,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, int32_t op_errno = 0; char *uuid_str = NULL; uuid_t node_uuid = {0,}; + int readdir_operrno = 0; gf_log (this->name, GF_LOG_INFO, "migate data called on %s", loc->path); @@ -1077,11 +1078,14 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, INIT_LIST_HEAD (&entries.list); while ((ret = syncop_readdirp (this, fd, 131072, offset, NULL, - &entries)) != 0) - { - if ((ret < 0) || (ret && (errno == ENOENT))) + &entries)) != 0) { + if (ret < 0) break; + /* Need to keep track of ENOENT errno, that means, there is no + need to send more readdirp() */ + readdir_operrno = errno; + free_entries = _gf_true; if (list_empty (&entries.list)) @@ -1225,6 +1229,8 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, free_entries = _gf_false; INIT_LIST_HEAD (&entries.list); + if (readdir_operrno == ENOENT) + break; } ret = 0; out: -- cgit