RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 717956 - quotaon fails on a loop device
Summary: quotaon fails on a loop device
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: Filesystem QE
URL:
Whiteboard:
Depends On:
Blocks: 685101 846704
TreeView+ depends on / blocked
 
Reported: 2011-06-30 14:17 UTC by Karel Volný
Modified: 2023-09-14 01:24 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-06 12:52:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Karel Volný 2011-06-30 14:17:36 UTC
Description of problem:
I'm unable to turn on quotas within the test /CoreOS/quota/Regression/bz77871-grace-period-not-shown

The test sets up quotas on a filesystem mounted via a loop device, everything (quotacheck, setquota) goes fine until quotaon, which reports error.

Version-Release number of selected component (if applicable):
quota-3.17-16.el6.i686

How reproducible:
always

Steps to Reproduce:
1. setup your device, mount it with quota enabled like
/tmp/tmp.CGIWazevOe/bz77871.img on /tmp/tmp.CGIWazevOe/bz77871 type ext2 (rw,loop=/dev/loop0,usrquota,quota)

2. quotacheck -c /tmp/tmp.CGIWazevOe/bz77871
ls -l /tmp/tmp.CGIWazevOe/bz77871/aquota.user

3. set some quota parameters - I  have:
setquota bz77871 128 256 0 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user
setquota -t 3600 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user

4. quotaon -v /tmp/tmp.CGIWazevOe/bz77871
  
Actual results:
:: [   PASS   ] :: Initialising quota files
-rw-------. 1 root root 7168 Jun 30 10:04 /tmp/tmp.CGIWazevOe/bz77871/aquota.user

^^^ you see the file exists

:: [   PASS   ] :: Setting the testing user quotas
:: [   PASS   ] :: Setting the grace time

^^^ no complaints from setquota

quotaon: using /tmp/tmp.CGIWazevOe/bz77871/aquota.user on /dev/loop0 [/tmp/tmp.CGIWazevOe/bz77871]: Invalid argument
quotaon: Maybe create new quota files with quotacheck(8)?

^^^ ahem, the quota file was created, see the ls output above?

:: [   FAIL   ] :: Turning quota on (Expected 0, got 1)


Expected results:
quota is turned on without any problem


Additional info:
the error message "Invalid argument" is not very helpful when the only argument is just the device where the quota should be turned on, which is perfectly valid (I also tried to use "/dev/loop0" instead)

Comment 2 Petr Pisar 2011-07-01 09:46:22 UTC
(In reply to comment #0)
> Steps to Reproduce:
> 1. setup your device, mount it with quota enabled like
> /tmp/tmp.CGIWazevOe/bz77871.img on /tmp/tmp.CGIWazevOe/bz77871 type ext2
> (rw,loop=/dev/loop0,usrquota,quota)
                               ^^^^^
Here you have quotas already enabled. You cannot run quotaon on file system with already enabled quotas.

However this is line from /etc/mtab which quota tools do not use if proc FS is available. They parse /proc/mounts instead because /etc/mtab is damaged by mount(8) usually.

> 2. quotacheck -c /tmp/tmp.CGIWazevOe/bz77871
> ls -l /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> 
> 3. set some quota parameters - I  have:
> setquota bz77871 128 256 0 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> setquota -t 3600 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> 
These commands cannot pass because you instruct setquota to operate on file  that is not a mount point. I will assume the trailing `aquota.user' is a typo.

> 4. quotaon -v /tmp/tmp.CGIWazevOe/bz77871
> 
> Actual results:
> :: [   PASS   ] :: Initialising quota files
> -rw-------. 1 root root 7168 Jun 30 10:04
> /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> 
> ^^^ you see the file exists
> 
> :: [   PASS   ] :: Setting the testing user quotas
> :: [   PASS   ] :: Setting the grace time
> 
> ^^^ no complaints from setquota
> 
> quotaon: using /tmp/tmp.CGIWazevOe/bz77871/aquota.user on /dev/loop0
> [/tmp/tmp.CGIWazevOe/bz77871]: Invalid argument
> quotaon: Maybe create new quota files with quotacheck(8)?
>
Cannot reproduce (with SELinux in permissive mode as the policy has not been updated in RHEL-6 yet).
 
> Additional info:
> the error message "Invalid argument" is not very helpful when the only
> argument is just the device where the quota should be turned on, which is
> perfectly valid (I also tried to use "/dev/loop0" instead)

This is transliteration of error EINVAL (strerror(errno)) returned from kernel when asking kernel to enable quotas on given file system.

Because I cannot reproduce it, I would like to ask you to provide exact sequence of commands you used, content of /proc/mounts before running quotaon, possibly strace of quotaon to see arguments passed to quotactl(2) syscall and state of you SELinux and relevant part (while running quotaon) of /var/log/audit/audit.log.

Comment 3 RHEL Program Management 2011-07-06 01:33:52 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 4 Karel Volný 2011-12-14 12:55:52 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > Steps to Reproduce:
> > 1. setup your device, mount it with quota enabled like
> > /tmp/tmp.CGIWazevOe/bz77871.img on /tmp/tmp.CGIWazevOe/bz77871 type ext2
> > (rw,loop=/dev/loop0,usrquota,quota)
>                                ^^^^^
> Here you have quotas already enabled. You cannot run quotaon on file system
> with already enabled quotas.

then it seems I got the docs wrong ... I thought having the quota parameter passed to mount is just a prerequisite to use quota, not that it is enough to activate quota

now the test specifies the mountpoint in fstab like this:

$TmpDir/bz77871.img $HomeDir ext2 loop,usrquota 0 0

- is that correct (after variable substitution)?

> However this is line from /etc/mtab which quota tools do not use if proc FS is
> available. They parse /proc/mounts instead because /etc/mtab is damaged by
> mount(8) usually.

mount now reports:

/tmp/tmp.2TnHBdHBfF/bz77871.img on /tmp/tmp.2TnHBdHBfF/bz77871 type ext2 (rw,loop=/dev/loop0,usrquota)

and /proc/mounts has this:

/dev/loop0 /tmp/tmp.2TnHBdHBfF/bz77871 ext2 rw,seclabel,relatime,errors=continue,usrquota 0 0

> > 2. quotacheck -c /tmp/tmp.CGIWazevOe/bz77871
> > ls -l /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> > 
> > 3. set some quota parameters - I  have:
> > setquota bz77871 128 256 0 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> > setquota -t 3600 0 /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> > 
> These commands cannot pass because you instruct setquota to operate on file 
> that is not a mount point. I will assume the trailing `aquota.user' is a typo.

um, yes, copy&paste from the test:

rlRun "quotacheck -c $HomeDir" 0 "Initialising quota files"                                                                                                    
rlRun "setquota bz77871 128 256 0 0 $HomeDir" 0 "Setting the testing user quotas"                                                                              
rlRun "setquota -t 3600 0 $HomeDir" 0 "Setting the grace time"                                                                                                 

where $HomeDir doesn't end in /aquota.user of course

> > 4. quotaon -v /tmp/tmp.CGIWazevOe/bz77871
> > 
> > Actual results:
> > :: [   PASS   ] :: Initialising quota files
> > -rw-------. 1 root root 7168 Jun 30 10:04
> > /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> > 
> > ^^^ you see the file exists
> > 
> > :: [   PASS   ] :: Setting the testing user quotas
> > :: [   PASS   ] :: Setting the grace time
> > 
> > ^^^ no complaints from setquota
> > 
> > quotaon: using /tmp/tmp.CGIWazevOe/bz77871/aquota.user on /dev/loop0
> > [/tmp/tmp.CGIWazevOe/bz77871]: Invalid argument
> > quotaon: Maybe create new quota files with quotacheck(8)?
> >
> Cannot reproduce

now that is strange, because I'm getting the error consistently:

quotaon: using /tmp/tmp.2TnHBdHBfF/bz77871/aquota.user on /dev/loop0 [/tmp/tmp.2TnHBdHBfF/bz77871]: Nepřípustný argument
quotaon: Maybe create new quota files with quotacheck(8)?
:: [   FAIL   ] :: Turning quota on (Expected 0, got 1)

> (with SELinux in permissive mode as the policy has not been
> updated in RHEL-6 yet).

... and it seems still wrong => bug #767579

> > Additional info:
> > the error message "Invalid argument" is not very helpful when the only
> > argument is just the device where the quota should be turned on, which is
> > perfectly valid (I also tried to use "/dev/loop0" instead)
> 
> This is transliteration of error EINVAL (strerror(errno)) returned from kernel
> when asking kernel to enable quotas on given file system.
> 
> Because I cannot reproduce it, I would like to ask you to provide exact
> sequence of commands you used, content of /proc/mounts before running quotaon,
> possibly strace of quotaon to see arguments passed to quotactl(2) syscall and
> state of you SELinux and relevant part (while running quotaon) of
> /var/log/audit/audit.log.

I guess it'd be better if you had a few minutes to sit together at the same machine ... please schedule some meeting or just ping me on irc

Comment 5 Petr Pisar 2011-12-15 16:20:43 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > (In reply to comment #0)
> > > Steps to Reproduce:
> > > 1. setup your device, mount it with quota enabled like
> > > /tmp/tmp.CGIWazevOe/bz77871.img on /tmp/tmp.CGIWazevOe/bz77871 type ext2
> > > (rw,loop=/dev/loop0,usrquota,quota)
> >                                ^^^^^
> > Here you have quotas already enabled. You cannot run quotaon on file system
> > with already enabled quotas.
> 
> then it seems I got the docs wrong ... I thought having the quota parameter
> passed to mount is just a prerequisite to use quota, not that it is enough to
> activate quota
> 

Sorry, I thought on XFS mistakenly. In ext file system, any of quota, usrquota, grpquota are prerequisite for quota tools, but they do not enable quota accounting nor enforcing at mount time. One need to quotaon the file system explicitly later then.

> now the test specifies the mountpoint in fstab like this:
> 
> $TmpDir/bz77871.img $HomeDir ext2 loop,usrquota 0 0
>
> - is that correct (after variable substitution)?
> 
Yes, this one is correct. `quota' option equals to `usrquota,grpquota' string. Any of the three should be sufficient to make quota tools thinking quotas should be handled on the file system.

> > However this is line from /etc/mtab which quota tools do not use if proc FS is
> > available. They parse /proc/mounts instead because /etc/mtab is damaged by
> > mount(8) usually.
> 
> mount now reports:
> 
> /tmp/tmp.2TnHBdHBfF/bz77871.img on /tmp/tmp.2TnHBdHBfF/bz77871 type ext2
> (rw,loop=/dev/loop0,usrquota)
> 
> and /proc/mounts has this:
> 
> /dev/loop0 /tmp/tmp.2TnHBdHBfF/bz77871 ext2
> rw,seclabel,relatime,errors=continue,usrquota 0 0
>
Great.

> rlRun "quotacheck -c $HomeDir" 0 "Initialising quota files"                     
> rlRun "setquota bz77871 128 256 0 0 $HomeDir" 0 "Setting the testing user quotas"                                                                         

There could be argument `-u' between `setquota' and `bz77871' to control user quotas (and not for example group quotas). Though `-u' option is default behavior.

> rlRun "setquota -t 3600 0 $HomeDir" 0 "Setting the grace time"                  
> 

The same applies here.

> > > 4. quotaon -v /tmp/tmp.CGIWazevOe/bz77871
> > > 
> > > Actual results:
> > > :: [   PASS   ] :: Initialising quota files
> > > -rw-------. 1 root root 7168 Jun 30 10:04
> > > /tmp/tmp.CGIWazevOe/bz77871/aquota.user
> > > 
> > > ^^^ you see the file exists

quotaon initializes and starts accounting and enforcing quotas in kernel. quota files (aquota.user) are initialized by quotackeck -c command. This message by test script is misleading.

> > > quotaon: using /tmp/tmp.CGIWazevOe/bz77871/aquota.user on /dev/loop0
> > > [/tmp/tmp.CGIWazevOe/bz77871]: Invalid argument
> > > quotaon: Maybe create new quota files with quotacheck(8)?
> > >
> > Cannot reproduce
> 
> now that is strange, because I'm getting the error consistently:
> 
> quotaon: using /tmp/tmp.2TnHBdHBfF/bz77871/aquota.user on /dev/loop0
> [/tmp/tmp.2TnHBdHBfF/bz77871]: Nepřípustný argument
> quotaon: Maybe create new quota files with quotacheck(8)?
> :: [   FAIL   ] :: Turning quota on (Expected 0, got 1)
> 
[...]
> I guess it'd be better if you had a few minutes to sit together at the same
> machine ... please schedule some meeting or just ping me on irc

I do.

Comment 6 Petr Pisar 2011-12-16 14:22:40 UTC
Finally, I can reproduce it on:

kernel-2.6.32-220.el6.x86_64
glibc-2.12-1.47.el6.x86_64
quota-3.17-16.el6.x86_64

with this script:


#!/bin/bash
set -x
IMG=/tmp/1.ext2
DIR=/mnt/quota

umount "$DIR"
rm "$IMG"

dd if=/dev/zero "of=${IMG}" bs=1M count=1
mkfs.ext2 -F "$IMG"
mount -o loop,usrquota "$IMG" "$DIR"
quotacheck -c "$DIR"
quotaon "$DIR"


If quotaon is executed very quickly after quotacheck, kernel returns EINVAL:

quotactl(Q_QUOTAON|USRQUOTA, "/dev/loop0", QFMT_VFS_V0, 0x7f21121201c0) = -1 EINVAL (Invalid argument)
quotaon: using /mnt/quota/aquota.user on /dev/loop0 [/mnt/quota]: Invalid argument

The last quotactl argument should point to quota file and is printed by quotaon tool in the subsequent message (using ... on). So the pointer is correct.

It looks like a race in kernel.

If sync(2) is called just before quotaon or some quotaon is delayed (about 10 seconds), quotactl(2) call succeeds.

I will reassign this issue to kernel.

To reporter: Use sync(1) until this issue will be solved.

Comment 7 Karel Volný 2011-12-16 15:20:41 UTC
(In reply to comment #6)
> To reporter: Use sync(1) until this issue will be solved.

I've added sync workaround so that this doesn't block testing of the original bug

however, I've done it just as fallback, so the test will be failing in the setup phase until this one is fixed, so that the test covers both bugs now

plus there is one outstanding selinux issue (RFE?) - bug #767579

anyways, thanks for looking into this

Comment 8 Karel Volný 2011-12-16 15:54:47 UTC
one more observation: this problem seems to happen only in Permissive selinux mode

I've been using Permissive because of the abovementioned bug #767579

I cannot reproduce this bug if I leave selinux in Enforcing mode and set the context of the directory to 'unconfined_u:object_r:home_root_t:s0'

Comment 9 Karel Volný 2011-12-16 15:59:55 UTC
remove RHTSdone from QA whiteboard & the TCMS reference, as the test doesn't work reliably, as per comment #8

Comment 11 RHEL Program Management 2012-05-03 04:53:23 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 12 RHEL Program Management 2012-12-14 07:13:27 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 13 Steve Whitehouse 2017-11-13 10:51:24 UTC
This is an old bug. Can you take a look and see if it is still an issue?

Comment 14 Jan Kurik 2017-12-06 12:52:15 UTC
Red Hat Enterprise Linux 6 is in the Production 3 Phase. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not meet the inclusion criteria for the Production 3 Phase and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Note that a strong business justification will be required for re-evaluation. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com/

Comment 15 Red Hat Bugzilla 2023-09-14 01:24:09 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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