Skip to content

Commit 005d5ae

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: make qi_dquots a 64-bit value
qi_dquots counts all quotas in the file system, which can be up to 3 * UINT_MAX and overflow a 32-bit counter, but can't be negative. Make qi_dquots a uint64_t, and saturate the value to UINT_MAX for userspace reporting. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 204c8f7 commit 005d5ae

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fs/xfs/xfs_qm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct xfs_quotainfo {
5757
struct xfs_inode *qi_pquotaip; /* project quota inode */
5858
struct xfs_inode *qi_dirip; /* quota metadir */
5959
struct list_lru qi_lru;
60-
int qi_dquots;
60+
uint64_t qi_dquots;
6161
struct mutex qi_quotaofflock;/* to serialize quotaoff */
6262
xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */
6363
uint qi_dqperchunk; /* # ondisk dq in above chunk */

fs/xfs/xfs_quotaops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ xfs_fs_get_quota_state(
6565
memset(state, 0, sizeof(*state));
6666
if (!XFS_IS_QUOTA_ON(mp))
6767
return 0;
68-
state->s_incoredqs = q->qi_dquots;
68+
state->s_incoredqs = min_t(uint64_t, q->qi_dquots, UINT_MAX);
6969
if (XFS_IS_UQUOTA_ON(mp))
7070
state->s_state[USRQUOTA].flags |= QCI_ACCT_ENABLED;
7171
if (XFS_IS_UQUOTA_ENFORCED(mp))

0 commit comments

Comments
 (0)