summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-04-02 16:32:18 +0530
committerAnand Avati <avati@redhat.com>2012-04-23 10:41:03 -0700
commitfc024df2b6f9307f23a4a0800103555708036b17 (patch)
treeb2582b6623e2791167ce23586ff00823991ddee5 /xlators
parentfdcbf065a9a4c39f08dfbe9e40695de250829bd8 (diff)
cluster/distribute: handle dht_layout_normalize errors differently in
dht_lookup_dir_cbk and dht_discover_complete. return value from dht_layout_normalize is interpreted as follows: ret > 0 - number of subvolumes returned ENOENT errors. ret = 0 - no anomalies found. ret < 0 - there are holes/overlaps. We need to handle errors differently in dht_discover_cbk because, if a subvolume is newly added, the directory will not be present on it and we cannot create a directory there since a nameless lookup has resulted execution in this code-path. Hence if directory is guaranteed to be present in atleast one subvolume and there are no holes/overlaps in the layout, lookup can be treated as successful. there is no change in behaviour dht_lookup_dir_cbk caused by this patch. Change-Id: I9b0b510f1c7de187be95a47da6c9ec57b5e38d1d BUG: 802233 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/3069 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c12
-rw-r--r--xlators/cluster/dht/src/dht-layout.c25
2 files changed, 22 insertions, 15 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 4010004f610..500c9735fc1 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -190,11 +190,15 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
}
} else {
ret = dht_layout_normalize (this, &local->loc, layout);
-
- if (ret != 0) {
+ if ((ret < 0) || ((ret > 0) && (local->op_ret != 0))) {
+ /* either the layout is incorrect or the directory is
+ * not found even in one subvolume.
+ */
gf_log (this->name, GF_LOG_DEBUG,
- "normalizing failed on %s",
- local->loc.path);
+ "normalizing failed on %s "
+ "(overlaps/holes present: %s, "
+ "ENOENT errors: %d)", local->loc.path,
+ (ret < 0) ? "yes" : "no", (ret > 0) ? ret : 0);
op_errno = EINVAL;
goto out;
}
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c
index d89e154214e..d1f8c9fbb0d 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -571,7 +571,6 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
uint32_t down = 0;
uint32_t misc = 0;
-
ret = dht_layout_sort (layout);
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
@@ -599,24 +598,28 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
"found anomalies in %s. holes=%d overlaps=%d",
loc->path, holes, overlaps);
}
- ret = 1;
+ ret = -1;
}
for (i = 0; i < layout->cnt; i++) {
- /* TODO During DHT selfheal rewrite (almost) find a better place to
- * detect this - probably in dht_layout_anomalies()
+ /* TODO During DHT selfheal rewrite (almost) find a better place
+ * to detect this - probably in dht_layout_anomalies()
*/
if (layout->list[i].err > 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "path=%s err=%s on subvol=%s",
- loc->path, strerror (layout->list[i].err),
- (layout->list[i].xlator ?
- layout->list[i].xlator->name : "<>"));
- if (layout->list[i].err == ENOENT)
- ret = 1;
+ gf_log_callingfn (this->name, GF_LOG_DEBUG,
+ "path=%s err=%s on subvol=%s",
+ loc->path,
+ strerror (layout->list[i].err),
+ (layout->list[i].xlator ?
+ layout->list[i].xlator->name
+ : "<>"));
+ if ((layout->list[i].err == ENOENT) && (ret >= 0)) {
+ ret++;
+ }
}
}
+
out:
return ret;
}