From 7edec07b139626bb64ea34e143a02dbfd28a6d9f Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 11 Apr 2012 16:14:16 +0530 Subject: storage/posix: Handle gfid-less lookup Change-Id: I4605dbb1dd8bf8e26de7f253e54a7f4840c8a8be BUG: 795355 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3128 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/storage/posix/src/posix.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 43bfb0bed73..168e7f7d2e6 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -109,6 +109,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this, char * real_path = NULL; char * par_path = NULL; struct iatt postparent = {0,}; + int32_t gfidless = 0; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); @@ -127,14 +128,19 @@ posix_lookup (call_frame_t *frame, xlator_t *this, goto out; } + op_ret = dict_get_int32 (xdata, GF_GFIDLESS_LOOKUP, &gfidless); + op_ret = -1; if (uuid_is_null (loc->pargfid)) { /* nameless lookup */ MAKE_INODE_HANDLE (real_path, this, loc, &buf); } else { MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &buf); - if (uuid_is_null (loc->inode->gfid)) + if (uuid_is_null (loc->inode->gfid)) { posix_gfid_set (this, real_path, loc, xdata); + MAKE_ENTRY_HANDLE (real_path, par_path, this, + loc, &buf); + } } op_errno = errno; @@ -172,11 +178,11 @@ out: if (xattr) dict_ref (xattr); - if (!op_ret && uuid_is_null (buf.ia_gfid)) { + if (!op_ret && !gfidless && uuid_is_null (buf.ia_gfid)) { gf_log (this->name, GF_LOG_ERROR, "buf->ia_gfid is null for " "%s", (real_path) ? real_path: ""); op_ret = -1; - op_errno = ENOENT; + op_errno = ENODATA; } STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, (loc)?loc->inode:NULL, &buf, xattr, &postparent); -- cgit