libgfapi: succeed lookup of "/.."

For the root dir, ".." should resolve to itself.

i.e. when
        glfs_h_lookupat (fs, NULL, "/..", &stat)
(or)
        glfs_h_lookupat (fs, root, "..", &stat)

is performed, stat must contain root dir's information.

Change-Id: I1c92091cdc4ff00e6b17e5fa349009c6dfc441c1
BUG: 1114814
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/8207
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
This commit is contained in:
Ravishankar N 2014-06-30 21:50:14 +00:00 committed by Vijay Bellur
parent c690c11312
commit f5f972189b

View File

@ -241,11 +241,15 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
uuid_copy (loc.pargfid, parent->gfid);
if (strcmp (component, ".") == 0)
if (strcmp (component, ".") == 0) {
loc.inode = inode_ref (parent);
else if (strcmp (component, "..") == 0)
loc.inode = inode_parent (parent, 0, 0);
else
} else if (strcmp (component, "..") == 0) {
if (__is_root_gfid (parent->gfid))
/* ".." on root points to itself */
loc.inode = inode_ref (parent);
else
loc.inode = inode_parent (parent, 0, 0);
} else
loc.inode = inode_grep (parent->table, parent, component);
if (loc.inode) {