Bug 1455022 - [GSS] Use of force with volume start, creates brick directory even it is not present
Summary: [GSS] Use of force with volume start, creates brick directory even it is not ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: index
Version: rhgs-3.2
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: ---
: RHGS 3.3.0
Assignee: Ravishankar N
QA Contact: Bala Konda Reddy M
URL:
Whiteboard:
Depends On:
Blocks: 1417151 1457202 1462636
TreeView+ depends on / blocked
 
Reported: 2017-05-24 05:01 UTC by Abhishek Kumar
Modified: 2017-09-21 04:58 UTC (History)
6 users (show)

Fixed In Version: glusterfs-3.8.4-29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1457202 (view as bug list)
Environment:
Last Closed: 2017-09-21 04:45:37 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2774 0 normal SHIPPED_LIVE glusterfs bug fix and enhancement update 2017-09-21 08:16:29 UTC

Description Abhishek Kumar 2017-05-24 05:01:37 UTC
Description of problem:

Use of force with volume create or volume start, creates brick directory even it is not present

Version-Release number of selected component (if applicable):

RHGS 3.2

How reproducible:

Everytime

Steps to Reproduce:
1. Run command gluster v create vol1 xx.xx.xx.xx:/test force
2. Even if /test is not present on xx.xx.xx.xx, it will create this path on root
3.Same thing is reproducible with gluster v start vol1

Actual results:

Use of force with volume create or volume start creates brick directory even it is not present

Expected results:

Use of force should not create brick directory if it is not present

Additional info:

Comment 3 Atin Mukherjee 2017-05-24 07:15:44 UTC
While the expectation of creating the directory (even in root partition) with volume create force is valid, but we do have a bug in volume start force codepath where the brick is getting recreated. GlusterD actually doesn't create this brick path. We have an issue in the index xlator here.

index_dir_create ()

int                                                                                 
index_dir_create (xlator_t *this, const char *subdir)                               
{                                                                                   
        int          ret = 0;                                                       
        struct       stat st = {0};                                                 
        char         fullpath[PATH_MAX] = {0};                                      
        char         path[PATH_MAX] = {0};                                          
        char         *dir = NULL;                                                   
        index_priv_t *priv = NULL;                                                  
        size_t       len = 0;                                                       
        size_t       pathlen = 0;                                                   
                                                                                    
        priv = this->private;                                                       
        make_index_dir_path (priv->index_basepath, subdir, fullpath,                
                             sizeof (fullpath));                                    
        ret = sys_stat (fullpath, &st);                                             
        if (!ret) {                                                                 
                if (!S_ISDIR (st.st_mode))                                          
                        ret = -2;                                                   
                goto out;                                                           
        }                                                                           
                                                                                    
        pathlen = strlen (fullpath);                                                
        if ((pathlen > 1) && fullpath[pathlen - 1] == '/')                          
                fullpath[pathlen - 1] = '\0';                                       
        dir = strchr (fullpath, '/');                                               
        while (dir) {                                                               
                dir = strchr (dir + 1, '/');                                        
                if (dir)                                                            
                        len = pathlen - strlen (dir);                               
                else                                                                
                        len = pathlen;                                              
                strncpy (path, fullpath, len);                                      
                path[len] = '\0';                                                   
                ret = sys_mkdir (path, 0600);  ====> this is actually creating the brickpath.                                      
                if (ret && (errno != EEXIST))                                                                                                                                                                                                 
                        goto out;                                                   
        }                                                                           
        ret = 0;                                                                    
out:                                                                                
        if (ret == -1) {                                                            
                gf_msg (this->name, GF_LOG_ERROR, errno,                            
                        INDEX_MSG_INDEX_DIR_CREATE_FAILED, "%s/%s: Failed to "  
                        "create", priv->index_basepath, subdir);                    
        } else if (ret == -2) {                                                     
                gf_msg (this->name, GF_LOG_ERROR, ENOTDIR,                          
                        INDEX_MSG_INDEX_DIR_CREATE_FAILED, "%s/%s: Failed to "  
                        "create, path exists, not a directory ",                    
                        priv->index_basepath, subdir);                              
        }                                                                           
        return ret;                                                                 
}

Comment 5 Ravishankar N 2017-05-31 10:14:20 UTC
https://review.gluster.org/17426

Comment 7 Ravishankar N 2017-06-19 07:19:25 UTC
Downstream patch: https://code.engineering.redhat.com/gerrit/#/c/109354/

Comment 9 Bala Konda Reddy M 2017-07-07 13:49:57 UTC
BUILD : 3.8.4-32

Creating the volume with force is valid even when the directory is not present. 
Created a volume and removed the brick by doing "rm -rf /bricks/brick1/testvol_1."
Then started the volume with force option.
The directory associated the volume is not re-created as expected.

Hence marking it as verified

Comment 11 errata-xmlrpc 2017-09-21 04:45:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2774

Comment 12 errata-xmlrpc 2017-09-21 04:58:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2774


Note You need to log in before you can comment on or make changes to this bug.