Bug 1265200 - quota: set quota version for files/directories
Summary: quota: set quota version for files/directories
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: quota
Version: rhgs-3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHGS 3.1.2
Assignee: Vijaikumar Mallikarjuna
QA Contact: storage-qa-internal@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1260783 1272411 1277080
TreeView+ depends on / blocked
 
Reported: 2015-09-22 11:16 UTC by Vijaikumar Mallikarjuna
Modified: 2016-09-17 12:40 UTC (History)
9 users (show)

Fixed In Version: glusterfs-3.7.5-6
Doc Type: Bug Fix
Doc Text:
Previously, when quota was disabled, the operation was terminated without completely cleaning up the quota xattrs. Due to this, when quota is enabled again, the quota accounting can get messed up. With this fix, a version number to each object is attached which resolves the issue.
Clone Of:
: 1272411 (view as bug list)
Environment:
Last Closed: 2016-03-01 05:36:34 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0193 0 normal SHIPPED_LIVE Red Hat Gluster Storage 3.1 update 2 2016-03-01 10:20:36 UTC

Description Vijaikumar Mallikarjuna 2015-09-22 11:16:37 UTC
When quota is disabled and this operation gets terminated without completely cleaning up the quota xattrs.
Now if quota is enabled again, this can mess up the quota accounting

Comment 3 Vijaikumar Mallikarjuna 2015-10-19 08:30:45 UTC
Upstream patch: http://review.gluster.org/#/c/12386/

Comment 4 Vijaikumar Mallikarjuna 2015-11-02 10:26:57 UTC
upstream patch:    http://review.gluster.org/#/c/12386/
release-3.7 patch: http://review.gluster.org/#/c/12487/
downstream patch: https://code.engineering.redhat.com/gerrit/60609

Comment 5 Anil Shah 2015-11-12 11:47:59 UTC
Verification failed.
Able to reproduce this bug again on build glusterfs-libs-3.7.5-6.el7rhgs.x86_64

[root@localhost newtest]# gluster v quota testvol disable
Disabling quota will delete all the quota configuration. Do you want to continue? (y/n) y
^V^C

[root@localhost newtest]# gluster v info
 
Volume Name: testvol
Type: Distributed-Replicate
Volume ID: 6e5023e1-5942-4146-933e-3d06d6921029
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: 10.70.47.143:/rhs/brick3/b1
Brick2: 10.70.47.145:/rhs/brick3/b2
Brick3: 10.70.47.2:/rhs/brick3/b3
Brick4: 10.70.47.3:/rhs/brick3/b4
Options Reconfigured:
features.inode-quota: off
features.quota: off
performance.readdir-ahead: on

[root@localhost newtest]# gluster v quota testvol enable

[root@localhost newtest]# gluster v quota testvol limit-usage / 2GB
quota command failed : Failed to find the directory /var/run/gluster/testvol/. Reason : No such file or directory

Comment 6 Vijaikumar Mallikarjuna 2015-11-16 11:41:11 UTC
Hi Anil,

You have mentioned two problems in comment# 5

Problem 1)
[root@localhost newtest]# gluster v quota testvol disable
Disabling quota will delete all the quota configuration. Do you want to continue? (y/n) y
^V^C

[root@localhost newtest]# gluster v info
Options Reconfigured:
features.inode-quota: off
features.quota: off

Once you execute command 'gluster v quota testvol disable', CLI will send the request to glusterd to perform the operation and waits for the result response from glusterd. 
If you kill CLI it will not receive and response, but glusterd will continue to execute the operation you initiated.


Problem 2)
[root@localhost newtest]# gluster v quota testvol enable

[root@localhost newtest]# gluster v quota testvol limit-usage / 2GB
quota command failed : Failed to find the directory /var/run/gluster/testvol/. Reason : No such file or directory

Need to investigate wht limit-usage on '/' is failing. File a new new bug for this 2nd problem I will investigate.

Comment 7 Vijaikumar Mallikarjuna 2015-11-16 11:52:02 UTC
Consider below example
1) When a quota is disabled, glusterd will initiate a backend process 'find / | xargs setxattr -x ....'
   to clean up all quota xattrs in the backend.
2) If there is a file
   /dir/a (if a is 1MB, file a and /dir and / will be accounted 1MB)
3) If a clanup process clean xattr from file a, but failed to cleanup xattr on /dir and / (may be node rebooted or process terminated)
4) now if quota is enabled
   file 'a' will be accounted 1MB, this 1MB is added to /dir and /
   /dir and / already has 1MB accounted which was not cleaned and after adding 1MB the quota usage becomes 2MB which is wrong...

To prevent this problem version number is added to the quota xattrs (suffixed in key)and this number is incremented on every enable operation

On first enable:
trusted.glusterfs.quota.size.1=0x0000000008c00000000000000000000e0000000000000001
trusted.glusterfs.quota.limit-set.1=0x0000000100000000ffffffffffffffff
trusted.glusterfs.quota.contri.0x0000000000000001.1=0x0000000008c00000000000000000000e0000000000000001

On second enable:
trusted.glusterfs.quota.size.2=0x0000000008c00000000000000000000e0000000000000001
trusted.glusterfs.quota.limit-set.2=0x0000000100000000ffffffffffffffff
trusted.glusterfs.quota.contri.0x0000000000000001.2=0x0000000008c00000000000000000000e0000000000000001

Comment 8 Anil Shah 2015-11-16 12:34:25 UTC
As discussed with Development team, Disabling and enabling will increment the trusted.glusterfs.quota.limit-set.2.

Marking this bug verified on build glusterfs-3.7.5-6.el7rhgs.x86_64

Comment 10 errata-xmlrpc 2016-03-01 05:36:34 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://rhn.redhat.com/errata/RHBA-2016-0193.html


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