summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-04-11 16:14:16 +0530
committerAnand Avati <avati@redhat.com>2012-04-12 15:23:16 -0700
commit7edec07b139626bb64ea34e143a02dbfd28a6d9f (patch)
tree002a35b9ecc677dc1369166844c71b17f80031fa
parenta3c61c6aea4045a6adafcc7350bd14f1e9c68ca1 (diff)
storage/posix: Handle gfid-less lookup
Change-Id: I4605dbb1dd8bf8e26de7f253e54a7f4840c8a8be BUG: 795355 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3128 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--xlators/storage/posix/src/posix.c12
2 files changed, 10 insertions, 3 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index bf34d94dc9a..d87451f68fd 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -106,6 +106,7 @@
/* Index xlator related */
#define GF_XATTROP_INDEX_GFID "glusterfs.xattrop_index_gfid"
+#define GF_GFIDLESS_LOOKUP "gfidless-lookup"
/* replace-brick and pump related internal xattrs */
#define RB_PUMP_CMD_START "glusterfs.pump.start"
#define RB_PUMP_CMD_PAUSE "glusterfs.pump.pause"
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);