summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2013-05-31 10:07:57 -0400
committerAnand Avati <avati@redhat.com>2013-06-03 01:06:36 -0700
commita3e593f9f17cb1e68db97bb5a0d8074793a33964 (patch)
treecc71f90a5fe2220e7e2e6e0f097870be1e862147 /xlators/cluster/dht/src/dht-common.c
parent9e974f9311869fb317c9c691ed09e7dd18047248 (diff)
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 <sgowda@redhat.com> Signed-off-by: shishir gowda <sgowda@redhat.com> Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/4959 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 8cbae676..fbde47df 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -148,9 +148,12 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
int op_errno = 0;
int ret = -1;
dht_layout_t *layout = NULL;
+ dht_conf_t *conf = NULL;
+ uint32_t missing = 0;
local = discover_frame->local;
layout = local->layout;
+ conf = this->private;
LOCK(&discover_frame->lock);
{
@@ -183,19 +186,27 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)
goto out;
}
} else {
- ret = dht_layout_normalize (this, &local->loc, layout);
- if ((ret < 0) || ((ret > 0) && (local->op_ret != 0))) {
- /* either the layout is incorrect or the directory is
- * not found even in one subvolume.
- */
+ ret = dht_layout_normalize (this, &local->loc, layout,
+ &missing);
+ if (ret < 0) {
gf_log (this->name, GF_LOG_DEBUG,
- "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;
+ "normalizing failed on %s (internal error)",
+ local->loc.path);
+ op_errno = EIO;
+ goto out;
+ }
+ if (missing == conf->subvolume_cnt) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "normalizing failed on %s, ENOENT errors: %u)",
+ local->loc.path, missing);
+ op_errno = ENOENT;
goto out;
}
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "normalizing failed on %s "
+ "(overlaps/holes present)", local->loc.path);
+ }
dht_layout_set (this, local->inode, layout);
}
@@ -397,6 +408,7 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_layout_t *layout = NULL;
int ret = -1;
int is_dir = 0;
+ uint32_t missing = 0;
GF_VALIDATE_OR_GOTO ("dht", frame, out);
GF_VALIDATE_OR_GOTO ("dht", this, out);
@@ -477,9 +489,16 @@ unlock:
}
if (local->op_ret == 0) {
- ret = dht_layout_normalize (this, &local->loc, layout);
-
- if (ret != 0) {
+ ret = dht_layout_normalize (this, &local->loc, layout,
+ &missing);
+
+ /*
+ * Arguably, we shouldn't do self-heal just because
+ * bricks are missing as long as there are no other
+ * anomalies. For now, though, just preserve the
+ * existing behavior.
+ */
+ if ((ret != 0) || (missing != 0)) {
gf_log (this->name, GF_LOG_DEBUG,
"fixing assignment on %s",
local->loc.path);