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 1665990 - df reports negative IUsed value for prjquota set directories.
Summary: df reports negative IUsed value for prjquota set directories.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kernel
Version: 7.6
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Bill O'Donnell
QA Contact: Zorro Lang
URL:
Whiteboard:
Depends On: 1665968
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-14 15:53 UTC by Achilles Gaikwad
Modified: 2019-08-06 12:25 UTC (History)
3 users (show)

Fixed In Version: kernel-3.10.0-1015.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1665968
Environment:
Last Closed: 2019-08-06 12:25:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4009611 0 None None None 2019-06-29 11:44:46 UTC
Red Hat Product Errata RHSA-2019:2029 0 None None None 2019-08-06 12:25:50 UTC

Description Achilles Gaikwad 2019-01-14 15:53:48 UTC
+++ This bug was initially created as a clone of Bug #1665968 +++

Description of problem:

df will report negative IUsed for a directory which has project quotas enabled.

df for the prjquota dir:
Filesystem     Inodes   IUsed  IFree IUse% Mounted on
/dev/loop7         53 -524229 524282     - /mnt

Version-Release number of selected component (if applicable):
4.18.0-32.el8.x86_64

How reproducible:
Always

Steps to Reproduce:

1. Create a repro.sh file with following contents and make it executable. 

#!/bin/bash
truncate -s1G foo.img 
mkfs.xfs -K -f foo.img > /dev/null 
mount foo.img /mnt/ -o prjquota 
mkdir -p /mnt/test 
xfs_quota -x -c 'project -s -p /mnt/test 42' /mnt
echo df before setting up limits
echo df for mnt
df -i /mnt/
echo df for prjquota dir
df -i /mnt/test
xfs_quota -x -c 'limit -p isoft=53 test-bug' /mnt
echo inode soft limits set for /mnt/test
xfs_quota -x -c report /mnt
echo df after setup for mnt: 
     df -i /mnt
echo df for the prjquota dir: 
     df -i /mnt/test/

echo unmounting
umount /mnt/

2. Execute the script. DF will show negative value

Filesystem     Inodes   IUsed  IFree IUse% Mounted on
/dev/loop7         53 -524229 524282     - /mnt
unmounting

Actual results:

Filesystem     Inodes   IUsed  IFree IUse% Mounted on
/dev/loop7         53 -524229 524282     - /mnt

Expected results:

Filesystem     Inodes   IUsed  IFree IUse% Mounted on
/dev/loop7         53     0      53     - /mnt


Additional info:

This bug has been fixed in commit the following commit 

$ git show de7243057e7cefa923fa5f467c0f1ec24eef41d2
commit de7243057e7cefa923fa5f467c0f1ec24eef41d2
Author: Ye Yin <dbyin>
Date:   Fri Nov 23 09:55:18 2018 -0800

    fs/xfs: fix f_ffree value for statfs when project quota is set
    
    When project is set, we should use inode limit minus the used count
    
    Signed-off-by: Ye Yin <dbyin>
    Reviewed-by: Darrick J. Wong <darrick.wong>
    Signed-off-by: Darrick J. Wong <darrick.wong>

diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index 73a1d77ec187..3091e4bc04ef 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -40,7 +40,7 @@ xfs_fill_statvfs_from_dquot(
                statp->f_files = limit;
                statp->f_ffree =
                        (statp->f_files > dqp->q_res_icount) ?
-                        (statp->f_ffree - dqp->q_res_icount) : 0;
+                        (statp->f_files - dqp->q_res_icount) : 0;
        }
 }
 

After applying the patch, I am not able to reproduce the issue.

Comment 5 Bruno Meneguele 2019-03-07 20:21:06 UTC
Patch(es) committed on kernel-3.10.0-1015.el7

Comment 10 errata-xmlrpc 2019-08-06 12:25:30 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://access.redhat.com/errata/RHSA-2019:2029


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