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>
This commit is contained in:
Anand Avati 2012-10-03 00:26:01 -07:00
parent 43514de5c0
commit 6c2e3e6a65

View File

@ -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) {