diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2011-11-05 14:54:28 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-11-23 00:32:44 -0800 |
commit | 119289fa51cd6e6ceb149dd3a9596478a85adff4 (patch) | |
tree | efc2c8e703ca96e784a246b63c2a6bcdaab522e5 | |
parent | 33477a140fb4e891a05dd9261013e83035155350 (diff) |
cluster/afr: Handle absence of gfid in lookup
Change-Id: I6295245a7f40ba4f786f1f9f35b337f3f711128d
BUG: 3783
Reviewed-on: http://review.gluster.com/739
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 01a092e2553..9ab321eb4b2 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -143,14 +143,12 @@ afr_lookup_save_gfid (uuid_t dst, void* new, const loc_t *loc) inode_t *inode = NULL; inode = loc->inode; - if (inode && !uuid_is_null (inode->gfid)) { + if (inode && !uuid_is_null (inode->gfid)) uuid_copy (dst, inode->gfid); - } else if (!uuid_is_null (loc->gfid)){ + else if (!uuid_is_null (loc->gfid)) uuid_copy (dst, loc->gfid); - } else { - GF_ASSERT (new && !uuid_is_null (new)); + else if (new && !uuid_is_null (new)) uuid_copy (dst, new); - } } int @@ -1700,6 +1698,7 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this) afr_local_t *local = NULL; int ret = -1; gf_boolean_t sh_launched = _gf_false; + gf_boolean_t fail_conflict = _gf_false; int gfid_miss_count = 0; int enotconn_count = 0; int up_children_count = 0; @@ -1723,7 +1722,18 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this) goto unwind; } - ret = afr_lookup_done_success_action (frame, this, _gf_false); + if ((gfid_miss_count == local->success_count) && + uuid_is_null (local->cont.lookup.gfid_req)) { + local->op_ret = -1; + local->op_errno = ENODATA; + gf_log (this->name, GF_LOG_ERROR, "%s: No gfid present", + local->loc.path); + goto unwind; + } + + if (gfid_miss_count && uuid_is_null (local->cont.lookup.gfid_req)) + fail_conflict = _gf_true; + ret = afr_lookup_done_success_action (frame, this, fail_conflict); if (ret) goto unwind; uuid_copy (local->self_heal.sh_gfid_req, local->cont.lookup.gfid_req); |