Bug 1196019

Summary: Any op on files in the root directory of the volume fails unless absolute path is specified.
Product: [Community] GlusterFS Reporter: Poornima G <pgurusid>
Component: libgfapiAssignee: Poornima G <pgurusid>
Status: CLOSED CURRENTRELEASE QA Contact: Sudhir D <sdharane>
Severity: high Docs Contact:
Priority: high    
Version: pre-releaseCC: bugs, gluster-bugs, lmohanty
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.7.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1196607 (view as bug list) Environment:
Last Closed: 2015-05-15 17:09:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1196607    

Description Poornima G 2015-02-25 05:42:33 UTC
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*/
...
glfs_fini();

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):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Anand Avati 2015-02-25 11:20:28 UTC
REVIEW: http://review.gluster.org/9744 (libgfapi: In glfs_init() set the cwd to "/".) posted (#1) for review on master by Poornima G (pgurusid)

Comment 2 Anand Avati 2015-02-27 05:38:32 UTC
REVIEW: http://review.gluster.org/9744 (libgfapi: In glfs_init() set the cwd to "/".) posted (#2) for review on master by Poornima G (pgurusid)

Comment 3 Anand Avati 2015-02-27 08:24:24 UTC
COMMIT: http://review.gluster.org/9744 committed in master by Niels de Vos (ndevos) 
------
commit 5dc152aac25ac7680ce0f83edc580d2a953d27a7
Author: Poornima G <pgurusid>
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:
    http://review.gluster.org/#/c/9671/
    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.
    
    Change-Id: I65018f6cd42539d09852069b84099034b9925418
    BUG: 1196019
    Signed-off-by: Poornima G <pgurusid>
    Reviewed-on: http://review.gluster.org/9744
    Reviewed-by: soumya k <skoduri>
    Reviewed-by: Rajesh Joseph <rjoseph>
    Reviewed-by: Niels de Vos <ndevos>
    Tested-by: Gluster Build System <jenkins.com>

Comment 4 Niels de Vos 2015-05-15 17:09:19 UTC
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 [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10939
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user