summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/afr/src/afr-common.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 1d1ac088178..ed366ce43bb 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2114,20 +2114,25 @@ afr_lookup (call_frame_t *frame, xlator_t *this,
frame->local = local;
local->fop = GF_FOP_LOOKUP;
- if (loc->path && !strcmp (loc->path, "/" GF_REPLICATE_TRASH_DIR)) {
- op_errno = ENOENT;
+ loc_copy (&local->loc, loc);
+ ret = loc_path (&local->loc, NULL);
+ if (ret < 0) {
+ op_errno = EINVAL;
goto out;
}
- loc_copy (&local->loc, loc);
+ if (!strcmp (local->loc.path, "/" GF_REPLICATE_TRASH_DIR)) {
+ op_errno = ENOENT;
+ goto out;
+ }
- ret = inode_ctx_get (loc->inode, this, &ctx);
+ ret = inode_ctx_get (local->loc.inode, this, &ctx);
if (ret == 0) {
/* lookup is a revalidate */
local->read_child_index = afr_inode_get_read_ctx (this,
- loc->inode,
- NULL);
+ local->loc.inode,
+ NULL);
} else {
LOCK (&priv->read_child_lock);
{
@@ -2165,14 +2170,14 @@ afr_lookup (call_frame_t *frame, xlator_t *this,
local->call_count = afr_up_children_count (local->child_up,
priv->child_count);
- ret = afr_lookup_xattr_req_prepare (local, this, xattr_req, loc,
+ ret = afr_lookup_xattr_req_prepare (local, this, xattr_req, &local->loc,
&gfid_req);
if (ret) {
local->op_errno = -ret;
goto out;
}
afr_lookup_save_gfid (local->cont.lookup.gfid_req, gfid_req,
- loc);
+ &local->loc);
local->fop = GF_FOP_LOOKUP;
for (i = 0; i < priv->child_count; i++) {
if (local->child_up[i]) {
@@ -2180,7 +2185,7 @@ afr_lookup (call_frame_t *frame, xlator_t *this,
(void *) (long) i,
priv->children[i],
priv->children[i]->fops->lookup,
- loc, local->xattr_req);
+ &local->loc, local->xattr_req);
if (!--call_count)
break;
}