Bug 1200670 - Convert quota size from n-to-h order before using it
Summary: Convert quota size from n-to-h order before using it
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: replicate
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Krutika Dhananjay
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1201622
TreeView+ depends on / blocked
 
Reported: 2015-03-11 06:39 UTC by Krutika Dhananjay
Modified: 2015-05-14 17:46 UTC (History)
2 users (show)

Fixed In Version: glusterfs-3.7.0
Clone Of:
: 1201622 (view as bug list)
Environment:
Last Closed: 2015-05-14 17:29:19 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Krutika Dhananjay 2015-03-11 06:39:34 UTC
Description of problem:

Figured while reading code that AFR is NOT converting quota_size value from network to host byte order before using it in comparisons towards getting the max size. This can cause problems with max_size calculation when the client is running on a little endian machine.

0 afr_handle_quota_size (call_frame_t *frame, xlator_t *this)                                                                                                                                                                                                                 
  1 {                                                                                
  2         unsigned char *readable = NULL;                                          
  3         afr_local_t *local = NULL;                                               
  4         afr_private_t *priv = NULL;                                              
  5         struct afr_reply *replies = NULL;                                        
  6         int i = 0;                                                               
  7         uint64_t size = 0;                                                       
  8         uint64_t max_size = 0;                                                   
  9         int readable_cnt = 0;                                                    
 10         int read_subvol = -1;                                                    
 11                                                                                  
 12         local = frame->local;                                                    
 13         priv = this->private;                                                    
 14         replies = local->replies;                                                
 15                                                                                  
 16         readable = alloca0 (priv->child_count);                                  
 17                                                                                  
 18         afr_inode_read_subvol_get (local->inode, this, readable, 0, 0);          
 19                                                                                  
 20         readable_cnt = AFR_COUNT (readable, priv->child_count);                  
 21                                                                                  
 22         for (i = 0; i < priv->child_count; i++) {                                
 23                 if (!replies[i].valid || replies[i].op_ret == -1)                
 24                         continue;                                                
 25                 if (readable_cnt && !readable[i])                                
 26                         continue;                                                
 27                 if (!replies[i].xdata)                                           
 28                         continue;                                                
 29                 if (dict_get_uint64 (replies[i].xdata, QUOTA_SIZE_KEY, &size))         <---------- here
 30                         continue;                                                
 32                 if (read_subvol == -1)                                           
 33                         read_subvol = i;                                         
 34                 if (size > max_size) {                                           
 35                         read_subvol = i;                                         
 36                         max_size = size;                                         
 37                 }                                                                
 38         }                                                                        
 39                                                                                  
 40         if (!max_size)                                                           
 41                 return read_subvol;                                              
 44                                                                                  
 45         for (i = 0; i < priv->child_count; i++) {                                
 46                 if (!replies[i].valid || replies[i].op_ret == -1)                
 47                         continue;                                                
 48                 if (readable_cnt && !readable[i])                                
 49                         continue;                                                
 50                 if (!replies[i].xdata)                                           
 51                         continue;                                                
 52                 if (dict_set_uint64 (replies[i].xdata, QUOTA_SIZE_KEY, max_size))       <------ and here
 53                         continue;                                                
 54         }                                                                        
 55                                                                                  
 56         return read_subvol;                                                      
 57 }                                                                  



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-03-11 06:58:22 UTC
REVIEW: http://review.gluster.org/9853 (cluster/afr: Convert quota size from n/w to host order before use) posted (#1) for review on master by Krutika Dhananjay (kdhananj)

Comment 2 Anand Avati 2015-03-12 11:44:55 UTC
REVIEW: http://review.gluster.org/9853 (cluster/afr: Convert quota size from n/w to host order before use) posted (#2) for review on master by Krutika Dhananjay (kdhananj)

Comment 3 Anand Avati 2015-03-13 06:02:04 UTC
COMMIT: http://review.gluster.org/9853 committed in master by Pranith Kumar Karampuri (pkarampu) 
------
commit 65c68fb75640be2c5744782081250dda886a7b56
Author: Krutika Dhananjay <kdhananj>
Date:   Tue Mar 10 22:11:57 2015 +0530

    cluster/afr: Convert quota size from n/w to host order before use
    
    Change-Id: I3e4fe15716556441546fcd62b8ac2833869b21cf
    BUG: 1200670
    Signed-off-by: Krutika Dhananjay <kdhananj>
    Reviewed-on: http://review.gluster.org/9853
    Reviewed-by: Ravishankar N <ravishankar>
    Reviewed-by: Anuradha Talur <atalur>
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Pranith Kumar Karampuri <pkarampu>
    Tested-by: Pranith Kumar Karampuri <pkarampu>

Comment 4 Niels de Vos 2015-05-14 17:29: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

Comment 5 Niels de Vos 2015-05-14 17:35:53 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

Comment 6 Niels de Vos 2015-05-14 17:38:15 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

Comment 7 Niels de Vos 2015-05-14 17:46:25 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


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