diff options
author | Raghavendra G <raghavendra@gluster.com> | 2012-04-02 16:32:18 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-04-23 10:41:03 -0700 |
commit | fc024df2b6f9307f23a4a0800103555708036b17 (patch) | |
tree | b2582b6623e2791167ce23586ff00823991ddee5 /xlators/cluster/dht/src/dht-common.c | |
parent | fdcbf065a9a4c39f08dfbe9e40695de250829bd8 (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/cluster/dht/src/dht-common.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 12 |
1 files changed, 8 insertions, 4 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; } |