summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2012-10-03 00:26:01 -0700
committerAnand Avati <avati@redhat.com>2012-10-03 15:04:09 -0700
commit6c2e3e6a651e0f507e812114ada00cc5f505b4f2 (patch)
treee57fcd2978298d3208ba589df9f9d039cfebbca6 /api/src/glfs-resolve.c
parent43514de5c0bf498a774bb197e5ab8c0833e72b70 (diff)
glfs-resolve: fix resolution of "/"
Change-Id: I78d63b39dde14a9a32ea197cf0dedeb5695b35c9 BUG: 839950 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4021 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 181d1788875..f7754d2019b 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -109,6 +109,28 @@ out:
}
+void
+glfs_resolve_base (struct glfs *fs, xlator_t *subvol, inode_t *inode,
+ struct iatt *iatt)
+{
+ loc_t loc = {0, };
+ int ret = -1;
+ char *path = NULL;
+
+ loc.inode = inode_ref (inode);
+ uuid_copy (loc.gfid, inode->gfid);
+
+ ret = inode_path (loc.inode, NULL, &path);
+ loc.path = path;
+ if (ret < 0)
+ goto out;
+
+ ret = syncop_lookup (subvol, &loc, NULL, iatt, NULL, NULL);
+out:
+ loc_wipe (&loc);
+}
+
+
inode_t *
glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
const char *component, struct iatt *iatt)
@@ -208,14 +230,17 @@ glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
}
parent = NULL;
- if (at && path[0] != '/')
+ if (at && path[0] != '/') {
/* A relative resolution of a path which starts with '/'
is equal to an absolute path resolution.
*/
inode = inode_ref (at);
- else
+ } else {
inode = inode_ref (subvol->itable->root);
+ glfs_resolve_base (fs, subvol, inode, &ciatt);
+ }
+
for (component = strtok_r (path, "/", &saveptr);
component; component = next_component) {