Bug 1077463

Summary: gfs2: quotas not refreshed in gfs2_adjust_quota
Product: Red Hat Enterprise Linux 6 Reporter: Abhijith Das <adas>
Component: kernelAssignee: Abhijith Das <adas>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: jpayne, ppisar, swhiteho
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.32-465.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1088740 (view as bug list) Environment:
Last Closed: 2014-10-14 06:03:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1088740    
Attachments:
Description Flags
Proposed fix none

Description Abhijith Das 2014-03-18 04:10:20 UTC
Description of problem:
When quota warn/limit values are specified using setquota for gfs2, they don't seem to take effect on the filesystem. With the filesystem mounted with quota=on, a user is able to exceed allotted quotas without the filesystem issuing warnings or returning error.

Version-Release number of selected component (if applicable):
Probably exists in upstream/rhel7 versions as well.

How reproducible:
Always

Steps to Reproduce:
[root@skol-01 rhel6]# dd if=/dev/zero of=/dev/skolo/1g bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 5.21575 s, 206 MB/s
[root@skol-01 rhel6]# mkfs.gfs2 -j1 -p lock_nolock /dev/skolo/1g -O
Device:                    /dev/skolo/1g
Blocksize:                 4096
Device Size                1.00 GB (262144 blocks)
Filesystem Size:           1.00 GB (262142 blocks)
Journals:                  1
Resource Groups:           4
Locking Protocol:          "lock_nolock"
Lock Table:                ""
UUID:                      ee4f26f7-6333-b612-420d-8863b1520047

[root@skol-01 rhel6]# mount -t gfs2 -o rw,relatime,nodiratime,localflocks,acl,quota=on /dev/skolo/1g /mnt/gfs2/
[root@skol-01 rhel6]# 
[root@skol-01 rhel6]# setquota -u test 10 20 0 0 /mnt/gfs2/
[root@skol-01 rhel6]# chmod 777 /mnt/gfs2
[root@skol-01 rhel6]# sync
[root@skol-01 rhel6]# 
[root@skol-01 rhel6]# su test
[test@skol-01 rhel6]$ /tmp/creator /mnt/gfs2 123 20
[test@skol-01 rhel6]$ exit
exit
[root@skol-01 rhel6]# 
[root@skol-01 rhel6]# sync
[root@skol-01 rhel6]# repquota -vu /mnt/gfs2
*** Report for user quotas on device /dev/dm-3
Block grace time: 00:00; Inode grace time: 00:00
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --       4       0       0              0     0     0       
test      +-      80       8      20              0     0     0       

*** Status for user quotas on device /dev/dm-3
Accounting: ON; Enforcement: ON
Inode: #33122 (24 blocks, 1 extents)

[root@skol-01 rhel6]# rm -Rf /mnt/gfs2/*
[root@skol-01 rhel6]# umount /mnt/gfs2

Actual results:
No quota warnings or errors and user is able to exceed quotas

Expected results:
Appropriate warning and errors should be returned and user shouldn't be allowed to exceed allotted quota

Comment 2 Petr Pisar 2014-03-18 08:45:49 UTC
And is it because GFS2 kernel driver slips the limits sometimes or because setquota should call Q_SYNC. And if the second one, how can you prevent from race (set, exceed limit, sync)? I was always told that this is how GFS2 behaves because it's distributed file system.

I gave a try with 2.6.32-431.el6.x86_64 and quota-3.17-21.el6_5.x86_64 and I get "Disk quota exceeded" error from dd(1) tool while creating the file. (Although kernel breaks at 24 KB).

This or that cannot be bug in user space. Assigning to kernel component.

Comment 4 RHEL Program Management 2014-03-26 00:11:18 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 5 Abhijith Das 2014-04-02 21:05:58 UTC
Created attachment 882009 [details]
Proposed fix

This patch causes the quota to be refreshed to the latest values so quotas are enforced correctly.

Comment 6 Abhijith Das 2014-04-17 20:38:42 UTC
Posted patch above to rhkernel-list for inclusion in RHEL6

Comment 7 Rafael Aquini 2014-05-14 12:34:59 UTC
Patch(es) available on kernel-2.6.32-465.el6

Comment 10 Justin Payne 2014-09-12 03:25:58 UTC
Verified in kernel-2.6.32-500.el6:

[root@dash-01 ~]# uname -r
2.6.32-500.el6.x86_64
[root@dash-01 ~]# dd if=/dev/zero of=/dev/mapper/mpathap1 bs=4G count=27
0+27 records in
0+27 records out
57981947904 bytes (58 GB) copied, 3816.36 s, 15.2 MB/s
[root@dash-01 ~]# mkfs.gfs2 -j1 -p lock_nolock /dev/mapper/mpathap1 -O
Device:                    /dev/mapper/mpathap1
Blocksize:                 4096
Device Size                100.00 GB (26214055 blocks)
Filesystem Size:           100.00 GB (26214053 blocks)
Journals:                  1
Resource Groups:           400
Locking Protocol:          "lock_nolock"
Lock Table:                ""
UUID:                      b1b7e47d-e211-1883-7b9c-a0852838eb3f

[root@dash-01 ~]# mount -t gfs2 -o rw,relatime,nodiratime,localflocks,acl,quota=on /dev/mapper/mpathap1 /mnt/gfs2/
[root@dash-01 ~]# setquota -u test 10 20 0 0 /mnt/gfs2/
[root@dash-01 ~]# chmod 777 /mnt/gfs2
[root@dash-01 ~]# sync
[root@dash-01 ~]# su test
[test@dash-01 root]$ /tmp/creator /mnt/gfs2 123 20
write(/mnt/gfs2/lrbbmqbhcdarzowkky) failed: Disk quota exceeded
create_and_write(/mnt/gfs2/lrbbmqbhcdarzowkky) failed: Disk quota exceeded
[test@dash-01 root]$ exit
exit
[root@dash-01 ~]# sync
[root@dash-01 ~]# repquota -vu /mnt/gfs2
*** Report for user quotas on device /dev/dm-5
Block grace time: 00:00; Inode grace time: 00:00
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --       4       0       0              0     0     0       
test      +-      24       8      20              0     0     0       

*** Status for user quotas on device /dev/dm-5
Accounting: ON; Enforcement: ON
Inode: #33132 (24 blocks, 1 extents)
[root@dash-01 ~]# rm -rf /mnt/gfs2/*
[root@dash-01 ~]# umount /mnt/gfs2/

Comment 11 errata-xmlrpc 2014-10-14 06:03:23 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/RHSA-2014-1392.html