Skip to content

Commit e645b79

Browse files
author
CKI KWF Bot
committed
Merge: [xfstests generic/762] over report free space or inodes in statvfs
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/859 JIRA: https://issues.redhat.com/browse/RHEL-89589 ``` commit f87d3af Author: Theodore Ts'o <tytso@mit.edu> Date: Fri Mar 14 00:38:42 2025 -0400 ext4: don't over-report free space or inodes in statvfs This fixes an analogus bug that was fixed in xfs in commit 4b8d867 ("xfs: don't over-report free space or inodes in statvfs") where statfs can report misleading / incorrect information where project quota is enabled, and the free space is less than the remaining quota. This commit will resolve a test failure in generic/762 which tests for this bug. Cc: stable@kernel.org Fixes: 689c958 ("ext4: add project quota support") Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>``` Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-05-06 10:16 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12334433&issuetype=1&priority=4&summary=backporter+webhook+issue&components=kernel-workflow+/+backporter)</small> Approved-by: Brian Foster <bfoster@redhat.com> Approved-by: Carlos Maiolino <cmaiolino@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 844f7e4 + 85f5ab7 commit e645b79

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

fs/ext4/super.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6780,22 +6780,29 @@ static int ext4_statfs_project(struct super_block *sb,
67806780
dquot->dq_dqb.dqb_bhardlimit);
67816781
limit >>= sb->s_blocksize_bits;
67826782

6783-
if (limit && buf->f_blocks > limit) {
6783+
if (limit) {
6784+
uint64_t remaining = 0;
6785+
67846786
curblock = (dquot->dq_dqb.dqb_curspace +
67856787
dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits;
6786-
buf->f_blocks = limit;
6787-
buf->f_bfree = buf->f_bavail =
6788-
(buf->f_blocks > curblock) ?
6789-
(buf->f_blocks - curblock) : 0;
6788+
if (limit > curblock)
6789+
remaining = limit - curblock;
6790+
6791+
buf->f_blocks = min(buf->f_blocks, limit);
6792+
buf->f_bfree = min(buf->f_bfree, remaining);
6793+
buf->f_bavail = min(buf->f_bavail, remaining);
67906794
}
67916795

67926796
limit = min_not_zero(dquot->dq_dqb.dqb_isoftlimit,
67936797
dquot->dq_dqb.dqb_ihardlimit);
6794-
if (limit && buf->f_files > limit) {
6795-
buf->f_files = limit;
6796-
buf->f_ffree =
6797-
(buf->f_files > dquot->dq_dqb.dqb_curinodes) ?
6798-
(buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0;
6798+
if (limit) {
6799+
uint64_t remaining = 0;
6800+
6801+
if (limit > dquot->dq_dqb.dqb_curinodes)
6802+
remaining = limit - dquot->dq_dqb.dqb_curinodes;
6803+
6804+
buf->f_files = min(buf->f_files, limit);
6805+
buf->f_ffree = min(buf->f_ffree, remaining);
67996806
}
68006807

68016808
spin_unlock(&dquot->dq_dqb_lock);

0 commit comments

Comments
 (0)