Description of problem:
If a test case is as follows:
fs = glfs_init();
glfs_mkdir(fs, "dir1", 0755); /* dir1 being relative to the root of the volume*/
The above test case fails for the below reason:
glfs_init() does not set the cwd to be "/", Hence with this patch the expectation would be that the path should be absolute always for a file directory under "/". i.e. the below statement succeeds:
glfs_mkdir (fs, "/dir1", 0755);
Expecting absolute patch for any file directly under "/", may break the existing users.
Two possible fixes:
In glfs_init(), set fs->cwd to "/", not sure if there can be other cases where it can be unset.
In glfs_resolve_path() even if glfs_cwd_get() returns NULL, call priv_glfs_resolve_at() as it handles that case.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
REVIEW: http://review.gluster.org/9744 (libgfapi: In glfs_init() set the cwd to "/".) posted (#1) for review on master by Poornima G (email@example.com)
REVIEW: http://review.gluster.org/9744 (libgfapi: In glfs_init() set the cwd to "/".) posted (#2) for review on master by Poornima G (firstname.lastname@example.org)
COMMIT: http://review.gluster.org/9744 committed in master by Niels de Vos (email@example.com)
Author: Poornima G <firstname.lastname@example.org>
Date: Wed Feb 25 15:44:59 2015 +0530
libgfapi: In glfs_init() set the cwd to "/".
Initially, when the cwd is NULL, while resolving a
relative path, it was taken to be relative from the root
of the volume.
But this behaviour changed with the patch:
with this patch, if cwd is NULL, all the fops on the files
(given relative path) under root directory will fail.
Hence, setting the cwd to "/" during glfs_init() itself.
Signed-off-by: Poornima G <email@example.com>
Reviewed-by: soumya k <firstname.lastname@example.org>
Reviewed-by: Rajesh Joseph <email@example.com>
Reviewed-by: Niels de Vos <firstname.lastname@example.org>
Tested-by: Gluster Build System <email@example.com>
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.7.0, please open a new bug report.
glusterfs-3.7.0 has been announced on the Gluster mailinglists , packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist  and the update infrastructure for your distribution.