summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2014-06-30 21:50:14 +0000
committerVijay Bellur <vbellur@redhat.com>2014-07-09 21:14:54 -0700
commitf5f972189b05515eaee9df2aa5afab6165887120 (patch)
tree985b1011e1de7d15bb4e1891f561acc445c1b73c /api/src
parentc690c1131288914d0081b817a5ae5ba51e051229 (diff)
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>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs-resolve.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 7cd1e47bc8f..fd0ed757ffe 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -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) {