]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
fix can not disable max_size quota 2782/head
authorLei Dong <leidong@yahoo-inc.com>
Mon, 27 Oct 2014 02:29:48 +0000 (10:29 +0800)
committerLei Dong <leidong@yahoo-inc.com>
Tue, 28 Oct 2014 03:18:35 +0000 (11:18 +0800)
commitabd3fd3ef9ee9999b99811937af60b7a5e673e35
tree66e35ea57b60afa26bb43895a9caaf830e24d587
parent1f566023eda0e8e10ea55c69caf7f37395c1adc1
fix can not disable max_size quota

Currently if we enable quota and set max_size = -1, it doesn’t
mean max_size is unlimited as expected. Instead, it means object
with any size is not allowed to upload because of “QuotaExceeded”.
The root cause is the function rgw_rounded_kb which convert max_size
to max_size_kb returns 0 for -1 because it takes an unsigned int
but we pass an int to it. A simple fix is check max_size before
it’s rounded to max_size_kb.

Test case:
1 enable and set quota:
radosgw-admin quota enable --uid={user_id} --quota-scope=user
radosgw-admin quota set --quota-scope=user --uid={user_id}\
 --max-objects=100 --max-size=-1
2 upload any object with non-zero length
it will return 403 with “QuotaExceeded” and return 200 if you apply the fix.

Fixes: #9907
Backport: giant, firefly
Signed-off-by: Dong Lei leidong@yahoo-inc.com
src/rgw/rgw_admin.cc