Bug 1012900 - [Quota]: Input values to limit-usage option are not validated properly
Summary: [Quota]: Input values to limit-usage option are not validated properly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat
Component: glusterfs
Version: 2.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Kaushal
QA Contact: Saurabh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-27 10:51 UTC by Sachidananda Urs
Modified: 2016-01-19 06:13 UTC (History)
7 users (show)

Fixed In Version: glusterfs-3.4.0.37rhs-1
Doc Type: Bug Fix
Doc Text:
Previously, volume quota limit-usage command wouldn't validate values too big (> ~18500PB), which could result in hard limit being set to zero. Now, in this update, limit-usage command would perform validation on values supplied to it, disallowing very large values as mentioned above.
Clone Of:
Environment:
Last Closed: 2013-11-27 15:40:58 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1769 0 normal SHIPPED_LIVE Red Hat Storage 2.1 enhancement and bug fix update #1 2013-11-27 20:17:39 UTC

Description Sachidananda Urs 2013-09-27 10:51:45 UTC
Description of problem:
When a very high value, let us say 100000PB is input to limit-usage, it screws up the Math. It does not validate the input and report value too high or not supported instead it overflows and Hard-limit is set to 0Bytes.
And also the `Used' space is computed wrong.

[root@boggs ~]# gluster volume quota pure_gold limit-usage /backup-1 100000PB
volume quota : success
[root@boggs ~]# gluster volume quota pure_gold list
                  Path                   Hard-limit Soft-limit   Used  Available
--------------------------------------------------------------------------------
/backup-2                                 10.0MB         0      24.5MB  0Bytes
/backup-2/backup-1                         5.1MB         0       8.2MB  0Bytes
/backup-1                                 0Bytes         0     800.3GB  0Bytes

The used space for the directory is not 800GB.
[root@bob-the-minion fuse]# du -sch backup-1/
11G     backup-1/

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

How reproducible:
Always

Steps to Reproduce:
1. Create a volume and enable quota. gluster volume quota <vol-name> enable
2. Input some huge value to limit-usage quota option 
3. gluster volume quota <volume-name> list

Actual results:
The input is not validated and reported.

Expected results:
It should either report a warning and exit stating input value too big or handle the input value and print. (In the above case 976EB)

Comment 6 Saurabh 2013-10-23 07:04:26 UTC
[root@quota1 ~]# gluster volume quota dist-rep3 list
                  Path                   Hard-limit Soft-limit   Used  Available
--------------------------------------------------------------------------------
/                                          1.0PB       80%      0Bytes   1.0PB
[root@quota1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_quota1-lv_root
                       44G  2.3G   40G   6% /
tmpfs                 4.9G     0  4.9G   0% /dev/shm
/dev/vda1             485M   32M  428M   7% /boot
/dev/mapper/RHS_vgvdb-RHS_lv1
                      421G  141G  281G  34% /rhs/brick1
localhost:dist-rep3   1.0P  1.0P  174G 100% /tmp/dist-rep3
[root@quota1 ~]# 
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 1024PB
volume quota : success
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 1024EB
Please enter a correct value
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 1024PB
volume quota : success
[root@quota1 ~]# 
[root@quota1 ~]# 
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 1024EB
Please enter a correct value
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 100%
Please enter a correct value
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 100NB
Please enter a correct value
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 100BN
Please enter a correct value
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 10000PB
volume quota : success
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 10000)PB
-bash: syntax error near unexpected token `)'
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 10000)PB
-bash: syntax error near unexpected token `)'
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 10000)PB
-bash: syntax error near unexpected token `)'
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume quota dist-rep3 limit-usage / 100000PB
Value too large: 100000PB
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume info dist-rep3
 
Volume Name: dist-rep3
Type: Distributed-Replicate
Volume ID: 13a8b57d-b65a-4ec9-93f7-cad8b1a8eeb6
Status: Started
Number of Bricks: 6 x 2 = 12
Transport-type: tcp
Bricks:
Brick1: 10.70.42.186:/rhs/brick1/d1r13
Brick2: 10.70.43.181:/rhs/brick1/d1r23
Brick3: 10.70.43.18:/rhs/brick1/d2r13
Brick4: 10.70.43.22:/rhs/brick1/d2r23
Brick5: 10.70.42.186:/rhs/brick1/d3r13
Brick6: 10.70.43.181:/rhs/brick1/d3r23
Brick7: 10.70.43.18:/rhs/brick1/d4r13
Brick8: 10.70.43.22:/rhs/brick1/d4r23
Brick9: 10.70.42.186:/rhs/brick1/d5r13
Brick10: 10.70.43.181:/rhs/brick1/d5r23
Brick11: 10.70.43.18:/rhs/brick1/d6r13
Brick12: 10.70.43.22:/rhs/brick1/d6r23
Options Reconfigured:
features.quota-deem-statfs: on
features.quota: on
[root@quota1 ~]# 
[root@quota1 ~]# gluster volume quota dist-rep3 list
                  Path                   Hard-limit Soft-limit   Used  Available
--------------------------------------------------------------------------------
/                                        10000.0PB       80%      0Bytes  0Bytes
[root@quota1 ~]# 


and then,

[root@quota1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
localhost:dist-rep3   421G  141G  281G  34% /tmp/dist-rep3


whereas,

Volume Name: dist-rep3
Type: Distributed-Replicate
Volume ID: 13a8b57d-b65a-4ec9-93f7-cad8b1a8eeb6
Status: Started
Number of Bricks: 6 x 2 = 12
Transport-type: tcp
Bricks:
Brick1: 10.70.42.186:/rhs/brick1/d1r13
Brick2: 10.70.43.181:/rhs/brick1/d1r23
Brick3: 10.70.43.18:/rhs/brick1/d2r13
Brick4: 10.70.43.22:/rhs/brick1/d2r23
Brick5: 10.70.42.186:/rhs/brick1/d3r13
Brick6: 10.70.43.181:/rhs/brick1/d3r23
Brick7: 10.70.43.18:/rhs/brick1/d4r13
Brick8: 10.70.43.22:/rhs/brick1/d4r23
Brick9: 10.70.42.186:/rhs/brick1/d5r13
Brick10: 10.70.43.181:/rhs/brick1/d5r23
Brick11: 10.70.43.18:/rhs/brick1/d6r13
Brick12: 10.70.43.22:/rhs/brick1/d6r23
Options Reconfigured:
features.quota-deem-statfs: on
features.quota: on

Comment 7 Kaushal 2013-10-23 07:41:55 UTC
I don't get what is wrong in what you've observed. From the command list you pasted, cli is correctly validating the input values and is working correctly.

Comment 13 Gowrishankar Rajaiyan 2013-10-30 08:32:40 UTC
(In reply to Kaushal from comment #12)
> (In reply to Saurabh from comment #11)
> > Fixed In Version, please
> 
> The latest fix has just been merged, but there isn't any build with the fix
> available yet. The errata system moved the bug automatically to ON_QA.

Hence, moving it to ASSIGNED. Please move it to ON_QA when fix is made available to verify.

Comment 14 Saurabh 2013-10-31 11:50:28 UTC
verified on glusterfs-3.4.0.37rhs

[root@quota1 ~]# gluster volume quota dist-rep5 list
                  Path                   Hard-limit Soft-limit   Used  Available
--------------------------------------------------------------------------------
/dir                                     7000.0PB       80%      0Bytes 7000.0PB
/                                        1000.0PB       80%      0Bytes 1000.0PB


also the result on rhel 6.2 client,
[root@rhsauto002 ~]# df -h /mnt/nfs-test
Filesystem            Size  Used Avail Use% Mounted on
10.70.42.186:/dist-rep5
                     1000P     0 1000P   0% /mnt/nfs-test
[root@rhsauto002 ~]# df -h /mnt/nfs-test/dir
Filesystem            Size  Used Avail Use% Mounted on
10.70.42.186:/dist-rep5
                      6.9E     0  6.9E   0% /mnt/nfs-test

Comment 16 errata-xmlrpc 2013-11-27 15:40:58 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.

http://rhn.redhat.com/errata/RHBA-2013-1769.html


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