Bug 762897 (GLUSTER-1165)

Summary: delete file larger than 2G cause server disk usage in quota reset to 0.
Product: [Community] GlusterFS Reporter: zls <zls0424>
Component: quotaAssignee: Junaid <junaid>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 3.0.5CC: amarts, gluster-bugs, joe, tejas, vagarwal, vijay
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
a possible patch
none
a considerable patch none

Description zls 2010-07-18 13:18:46 UTC
in quota_unlink_cbk, space_freed is defined as int. so if the file deleted is la
rger than 2G, it becomes a negative number and then converted to a very large unsigned long (size_t) number in gf_quota_usage_subtract, which is larger than current_disk_usage, so current_disk_usage is set to 0.

also in other callbacks in quota.c

Comment 1 zls 2010-07-18 23:22:01 UTC
Created attachment 254 [details]
/proc/cpuinfo of affected machine...

Comment 2 zls 2010-07-21 13:31:54 UTC
sorry, this is not the only problem, and the previous patch is not enough.

For example, in quota_truncate_cbk, if size of file "/dfs/abcd" is 1024, we run
"> /dfs/abcd", it will be truncated to zero first. then space_freed will be (0 - 1024) * 512 = -524288, when calling gf_quota_usage_subtract, the 2nd param will be converted to an unsigned long with value 18446744073709027328 (0xfffffffffff80000), which will cause disk usage reset to 0.

And in quota_unlink_cbk, if we unlink a file with size 0, the blocks of its parent directory used may become smaller. Then space_freed = 0 + (0 - 8) * 512, the same problem as above, and the disk usage will be reset to 0.

Comment 3 zls 2010-07-21 13:36:06 UTC
Created attachment 256 [details]
rpm -qa of machine affected

Comment 4 zls 2010-07-29 15:48:27 UTC
Sorry, please ignore my patch. It did fix some problems, but not enough, too. and it brought in two new problems.

After these modifies, we found sometimes the usage is still not calculated correctly. it's not easy to resolve this problem completely. So we get disk usage frequently by calling du. Maybe this feature should be redesigned.

Comment 5 Joe Julian 2010-08-30 15:37:43 UTC
Also if you delete a file over 4g, the space available is only reduced by the
amount over 4g. Obviously this is also due to the size_t overflow.

Comment 6 Amar Tumballi 2010-10-07 10:05:11 UTC
quota is not being supported in 3.1.0 version, we will get the support post 3.1, hence moving severity.

Comment 7 Amar Tumballi 2011-01-21 07:56:16 UTC
All the quota related bugs moved to one bug for now, as we may have new code for quota

*** This bug has been marked as a duplicate of bug 1243 ***