From a3e593f9f17cb1e68db97bb5a0d8074793a33964 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Fri, 31 May 2013 10:07:57 -0400 Subject: cluster/dht: Return success in dht_discover if layout issues We cannot heal in dht_discover, as it is a gfid based lookup, and not path based. So, returning error here would lead to app's to see failure. Also, update the layout in inode_ctx even if it has anomalies. Let subsequent heals fix the issue. Change-Id: I2358aadacf9a24e20a22ab0a6055c38c5eb6485c BUG: 960348 Original-author: shishir gowda Signed-off-by: shishir gowda Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/4959 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-layout.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'xlators/cluster/dht/src/dht-layout.c') diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 057229869..07e8cbae4 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -593,7 +593,8 @@ dht_layout_anomalies (xlator_t *this, loc_t *loc, dht_layout_t *layout, int -dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) +dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout, + uint32_t *missing_p) { int ret = 0; int i = 0; @@ -605,6 +606,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) ret = dht_layout_sort (layout); if (ret == -1) { + /* defensive coding; this can't happen currently */ gf_log (this->name, GF_LOG_WARNING, "sort failed?! how the ...."); goto out; @@ -614,23 +616,26 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) &holes, &overlaps, &missing, &down, &misc, NULL); if (ret == -1) { + /* defensive coding; this can't happen currently */ gf_log (this->name, GF_LOG_WARNING, "error while finding anomalies in %s -- not good news", loc->path); goto out; } - if (holes || overlaps) { + ret = holes + overlaps; + if (ret) { if (missing == layout->cnt) { gf_log (this->name, GF_LOG_DEBUG, "directory %s looked up first time", loc->path); } else { gf_log (this->name, GF_LOG_INFO, - "found anomalies in %s. holes=%d overlaps=%d", - loc->path, holes, overlaps); + "found anomalies in %s. holes=%d overlaps=%d" + " missing=%d down=%d misc=%d", + loc->path, holes, overlaps, missing, down, + misc); } - ret = -1; } for (i = 0; i < layout->cnt; i++) { @@ -645,14 +650,14 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout) (layout->list[i].xlator ? layout->list[i].xlator->name : "<>")); - if ((layout->list[i].err == ENOENT) && (ret >= 0)) { - ret++; - } } } out: + if (missing_p) { + *missing_p = missing; + } return ret; } -- cgit