From: Chao Yu <chao@kernel.org>
To: Zorro Lang <zlang@kernel.org>, fstests@vger.kernel.org
Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
Chao Yu <chao@kernel.org>, "Darrick J. Wong" <djwong@kernel.org>
Subject: [PATCH v2] common/quota: fix to wait for all inodes been evicted in _check_quota_usage()
Date: Sat, 6 Dec 2025 08:40:17 +0800 [thread overview]
Message-ID: <20251206004017.4021067-1-chao@kernel.org> (raw)
generic/233 3s ... - output mismatch (see /share/git/fstests/results//generic/233.out.bad)
--- tests/generic/233.out 2025-01-12 21:57:40.259440359 +0800
+++ /share/git/fstests/results//generic/233.out.bad 2025-12-04 03:02:26.000000000 +0800
@@ -4,4 +4,12 @@
seed = S
Comparing user usage
+4c4
+< #1000 -- 31476 32000 32000 994 1000 1000
+---
+> #1000 -- 31476 32000 32000 944 1000 1000
...
(Run 'diff -u /share/git/fstests/tests/generic/233.out /share/git/fstests/results//generic/233.out.bad' to see the entire diff)
Ran: generic/233
Failures: generic/233
Failed 1 of 1 tests
Sometimes, generic/233 will fail due to it founds inode count is mismatched
in between quota system and filesystem.
The reason is cgroup v2 implementation will increase inode reference first,
and then, attach it to thread related cgroup writeback structure, once it
needs to switch write owner of target inode, a kernel thread will process
it, and finally release inode reference via evict_inode().
So, sync & drop_cache may not guarantee all inodes being evicted, as cgroup
has one more referenece on inodes during the time.
If inode has not been evicted, dquot inode reference will not be release, it
will lead to inode count mismatch.
Let's add a delay to wait for cgroup switching completion before quota check.
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
---
v2:
- sleep only for f2fs case
common/quota | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/common/quota b/common/quota
index a51386b1..a7239501 100644
--- a/common/quota
+++ b/common/quota
@@ -333,6 +333,11 @@ _check_quota_usage()
# XXX: really need an ioctl instead of this big hammer
echo 3 > /proc/sys/vm/drop_caches
+ if [ $FSTYP == "f2fs" ]; then
+ # wait for inode_switch_wbs_wor_fn() to release inodes
+ sleep 3
+ fi
+
VFS_QUOTA=0
case $FSTYP in
ext2|ext3|ext4|f2fs|gfs2|bcachefs)
--
2.49.0
next reply other threads:[~2025-12-06 0:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 0:40 Chao Yu [this message]
2025-12-08 17:02 ` [PATCH v2] common/quota: fix to wait for all inodes been evicted in _check_quota_usage() Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251206004017.4021067-1-chao@kernel.org \
--to=chao@kernel.org \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=zlang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox