[Top] [All Lists]

[PATCH] repquota does't report correct space usage

To: xfs@xxxxxxxxxxx
Subject: [PATCH] repquota does't report correct space usage
From: Utako Kusaka <utako@xxxxxxxxxxxxxx>
Date: Wed, 28 Feb 2007 16:33:17 +0900
Sender: xfs-bounce@xxxxxxxxxxx

repquota may report incorrect space usage when the filesystem is mounted
repeatedly with different quota options.
The cause of the problem is that xfs_qm_quotacheck() is not called because
the `CHKD' flag in mp->m_qflags is not cleared until it is mounted with 
no quota option. This patch fixes it.

Test case:
mkfs.xfs -f /dev/sda6

mount -t xfs -o usrquota,grpquota /dev/sda6 mpnt/
setquota -u utako 3000 4000 0 0 /dev/sda6
setquota -u xfs 1500 2000 0 0 /dev/sda6
setquota -g users 1000 1500 0 0 /dev/sda6
repquota -ugv -a
umount mpnt/

mount -t xfs -o usrquota /dev/sda6 mpnt/
xfs_mkfile 3m mpnt/file1
xfs_mkfile 1m mpnt/file2
chown utako mpnt/file1
chown xfs mpnt/file2
chgrp users mpnt/file*
repquota -ugv -a
umount mpnt/

mount -t xfs -o grpquota /dev/sda6 mpnt/
repquota -ugv -a
rm mpnt/file1
repquota -ugv -a

*** Report for group quotas on device /dev/sda6
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
Group           used    soft    hard  grace    used  soft  hard  grace
root      --       0       0       0              3     0     0
users     +- 18014398509478912    1000    1500  7days 18446744073709551615     
0     0

*** Status for group quotas on device /dev/sda6
Accounting: ON; Enforcement: ON
Inode: #132 (2 blocks, 2 extents)

Signed-off-by: Utako Kusaka <utako@xxxxxxxxxxxxxx>

--- linux-2.6.20-orgn/fs/xfs/quota/xfs_qm.c.orgn        2007-02-22 
17:30:07.000000000 +0900
+++ linux-2.6.20/fs/xfs/xfs_qm.c        2007-02-22 17:30:58.000000000 +0900
@@ -1175,8 +1175,6 @@ xfs_qm_init_quotainfo(
        qinf->qi_dqperchunk = BBTOB(qinf->qi_dqchunklen);
        do_div(qinf->qi_dqperchunk, sizeof(xfs_dqblk_t));

-       mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD);
         * We try to get the limits from the superuser's limits fields.
         * This is quite hacky, but it is standard quota practice.

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] repquota does't report correct space usage, Utako Kusaka <=