From: Avinesh Kumar <avinesh.kumar@suse.com>
To: djwong@kernel.org, fstests@vger.kernel.org
Cc: avinesh.kumar@suse.com, wqu@suse.com
Subject: [PATCH v3] generic/798: chain xfs_io commands into a single invocation
Date: Wed, 26 Aug 2026 17:54:23 +0200 [thread overview]
Message-ID: <20260826155423.183785-1-avinesh.kumar@suse.com> (raw)
In-Reply-To: <20260826152014.GT839663@frogsfrogsfrogs>
From: Avinesh Kumar <avinesh.kumar@suse.com>
The write, cachestat, fsync, and cachestat calls were each run as
separate xfs_io invocations, closing and reopening the file in
between. Some filesystems flush dirty data back on close(), clearing
the dirty bit before the first cachestat ever ran, causing test failure
- output mismatch (see /opt/xfstests/results//generic/798.out.bad)
--- tests/generic/798.out 2026-08-20 05:25:39.000000000 -0400
+++ /opt/xfstests/results//generic/798.out.bad 2026-08-21 12:30:39.831381108 -0400
@@ -1,16 +1,16 @@
QA output created by 798
=== Test with 1 pages ===
-Cached: 1, Dirty: 1, Writeback: 0, Evicted: 0, Recently Evicted: 0
+Cached: 1, Dirty: 0, Writeback: 0, Evicted: 0, Recently Evicted: 0
Cached: 1, Dirty: 0, Writeback: 0, Evicted: 0, Recently Evicted: 0
=== Test with 2 pages ===
-Cached: 2, Dirty: 2, Writeback: 0, Evicted: 0, Recently Evicted: 0
...
Run the whole sequence on one open file descriptor instead by chaining
all xfs_io commands in single invocation.
Suggested-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
tests/generic/798 | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tests/generic/798 b/tests/generic/798
index 0fe37646..5c81b429 100755
--- a/tests/generic/798
+++ b/tests/generic/798
@@ -27,12 +27,21 @@ for num_page in 1 2 4 8 16; do
echo "=== Test with $num_page pages ==="
rm -f $SCRATCH_MNT/foobar
- $XFS_IO_PROG -f -c "pwrite -b $pagesize 0 $size" $SCRATCH_MNT/foobar > /dev/null
- # Basic cached number reporting
- $XFS_IO_PROG -c "cachestat 0 $size" $SCRATCH_MNT/foobar
- # Test dirty page number reporting after a fsync.
- $XFS_IO_PROG -c "fsync" -c "cachestat 0 $size" $SCRATCH_MNT/foobar
+ # Basic cached number reporting and test dirty page number
+ # reporting after a fsync.
+ #
+ # Do the whole write+cachestat+fsync+cachestat sequence in a
+ # single xfs_io invocation. Some filesystems (e.g. NFS) flush
+ # dirty data back to the server as part of their own close()-time
+ # cache consistency, which would clear the dirty bits before the
+ # second xfs_io process ever got to run cachestat.
+ $XFS_IO_PROG -f \
+ -c "pwrite -q -b $pagesize 0 $size" \
+ -c "cachestat 0 $size" \
+ -c "fsync" \
+ -c "cachestat 0 $size" \
+ $SCRATCH_MNT/foobar
done
_scratch_unmount
--
2.55.0
next prev parent reply other threads:[~2026-08-26 15:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 15:11 [PATCH] generic/798: exclude nfs from cachestat dirty page reporting test Avinesh Kumar
2026-08-24 16:15 ` Darrick J. Wong
2026-08-26 14:39 ` Avinesh Kumar
2026-08-26 15:01 ` [PATCH v2] generic/798: chain xfs_io commands into a single invocation Avinesh Kumar
2026-08-26 15:20 ` Darrick J. Wong
2026-08-26 15:54 ` Avinesh Kumar [this message]
2026-08-26 16:15 ` [PATCH v3] " Darrick J. Wong
2026-08-26 17:00 ` Zorro Lang
2026-08-26 22:13 ` Qu Wenruo
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=20260826155423.183785-1-avinesh.kumar@suse.com \
--to=avinesh.kumar@suse.com \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=wqu@suse.com \
/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