generic/798: exclude nfs from cachestat dirty page reporting test
PATCH 1/1 generic/798: exclude nfs from cachestat dirty page reporting test
From: Avinesh Kumar <[email protected]>
generic/798 checks cachestat() page cache dirty state between write and fsync operations.
On NFS, the client flushes dirty pages to the server during close() to enforce its close-to-open consistency model. Because the test uses separate xfs_io invocations, the file is closed after writing, leaving pages already clean by the time the subsequent cachestat command executes, causing the test to fail.
- 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
...Exclude 'nfs' from running this test.
--- tests/generic/798 | 6 ++++++ 1 file changed, 6 insertions(+)
tests/generic/798 +6 -0
@@ -16,6 +16,12 @@ _require_scratch _exclude_scratch_mount_option "dax" _exclude_scratch_mount_option "sync" +# NFS flushes dirty data back to the server on close() as part of its +# close-to-open cache consistency model, so a page written and closed in +# one xfs_io invocation is no longer dirty by the time cachestat runs in +# a later invocation. +_exclude_fs nfs + pagesize=$(_get_page_size) _scratch_mkfs > /dev/null
Signature · 1 line
2.55.0
Quoted 36 lines · Avinesh Kumar
From: Avinesh Kumar <[email protected]>
generic/798 checks
cachestat()page cache dirty state between write and fsync operations.On NFS, the client flushes dirty pages to the server during
close()to enforce its close-to-open consistency model. Because the test uses separatexfs_ioinvocations, the file is closed after writing, leaving pages already clean by the time the subsequent cachestat command executes, causing the test to fail.- 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 ...Exclude 'nfs' from running this test.
Signed-off-by Avinesh Kumar <[email protected]>--- tests/generic/798 | 6 ++++++ 1 file changed, 6 insertions(+)tests/generic/798 +0
-0
tests/generic/798 _require_scratch · line 23
Quoted 8 lines
tests/generic/798 +5
-0@@ -16,6 +16,12 @@ _require_scratch _exclude_scratch_mount_option "dax" _exclude_scratch_mount_option "sync" +# NFS flushes dirty data back to the server on close() as part of its +# close-to-open cache consistency model, so a page written and closed in +# one xfs_io invocation is no longer dirty by the time cachestat runs in +# a later invocation. +_exclude_fs nfs
Could you just chain all the xfs_io commands together into a single invocation?
$XFS_IO_PROG -f \ -c "pwrite -b $pagesize 0 $size" \ -c "cachestat 0 $size" \ -c "fsync" \ -c "cachestat 0 $size" \ $SCRATCH_MNT/foobar
to solve this problem?
--D
Quoted 8 lines
tests/generic/798 +1
-0+ pagesize=$(_get_page_size) _scratch_mkfs > /dev/nullSignature · 1 line
2.55.0
Hello Darrick,
Quoted 17 lines
tests/generic/798 _require_scratch · line 23
Quoted 13 lines
tests/generic/798 +5
-0@@ -16,6 +16,12 @@ _require_scratch _exclude_scratch_mount_option "dax" _exclude_scratch_mount_option "sync" +# NFS flushes dirty data back to the server on close() as part of its +# close-to-open cache consistency model, so a page written and closed in +# one xfs_io invocation is no longer dirty by the time cachestat runs in +# a later invocation. +_exclude_fs nfsCould you just chain all the
xfs_iocommands together into a single invocation?
Quoted 9 lines
$XFS_IO_PROG -f \ -c "pwrite -b $pagesize 0 $size" \ -c "cachestat 0 $size" \ -c "fsync" \ -c "cachestat 0 $size" \ $SCRATCH_MNT/foobarto solve this problem?
Thanks for the review and this suggestion. Chaining all xfs_io commands together seems to work, with also passing '-q' to pwrite to suppress these lines -
+wrote 4096/4096 bytes at offset 0
+4 KiB, 1 ops; 0.0000 sec (355.114 MiB/sec and 90909.0909 ops/sec)I am sending revised patch.
Regards,
Avinesh
PATCH v2 1/1 generic/798: chain xfs_io commands into a single invocation
In reply to Darrick J. WongFrom: Avinesh Kumar <[email protected]>
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.
--- tests/generic/798 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
tests/generic/798 +14 -4
@@ -27,12 +27,22 @@ 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. + # 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 -c "fsync" -c "cachestat 0 $size" $SCRATCH_MNT/foobar + $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
Signature · 1 line
2.55.0
Re: [PATCH v2] generic/798: chain xfs_io commands into a single invocation
Quoted 42 lines · Avinesh Kumar
From: Avinesh Kumar <[email protected]>
The write, cachestat, fsync, and cachestat calls were each run as separate
xfs_ioinvocations, closing and reopening the file in between. Some filesystems flush dirty data back onclose(), 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_iocommands in single invocation.Suggested-by "Darrick J. Wong" <[email protected]>Signed-off-by Avinesh Kumar <[email protected]>--- tests/generic/798 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)tests/generic/798 +0
-4@@ -27,12 +27,22 @@ 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.
tests/generic/798 for num_page in 1 2 4 8 16; do · line 40
Quoted 10 lines
tests/generic/798 +9
-0+ # 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 -c "fsync" -c "cachestat 0 $size" $SCRATCH_MNT/foobar + $XFS_IO_PROG -f \
Not sure why there are two $XFS_IO_PROG invocations here??
Also the first line of the second invocation should only be indented one tab, not two.
--D
Quoted 12 lines
tests/generic/798 +5
-0+ -c "pwrite -q -b $pagesize 0 $size" \ + -c "cachestat 0 $size" \ + -c "fsync" \ + -c "cachestat 0 $size" \ + $SCRATCH_MNT/foobar done _scratch_unmountSignature · 1 line
2.55.0
PATCH v3 1/1 generic/798: chain xfs_io commands into a single invocation
From: Avinesh Kumar <[email protected]>
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.
--- tests/generic/798 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
tests/generic/798 +14 -5
@@ -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
Signature · 1 line
2.55.0
Re: [PATCH v3] generic/798: chain xfs_io commands into a single invocation
Quoted 20 lines · Avinesh Kumar
From: Avinesh Kumar <[email protected]>
The write, cachestat, fsync, and cachestat calls were each run as separate
xfs_ioinvocations, closing and reopening the file in between. Some filesystems flush dirty data back onclose(), 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 ...
Quoted 5 lines
Run the whole sequence on one open file descriptor instead by chaining all
xfs_iocommands in single invocation.Suggested-by "Darrick J. Wong" <[email protected]>Signed-off-by Avinesh Kumar <[email protected]>
Looks good now!
--D
Quoted 39 lines
--- tests/generic/798 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)tests/generic/798 +14
-5@@ -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_unmountSignature · 1 line
2.55.0
Re: [PATCH v3] generic/798: chain xfs_io commands into a single invocation
In reply to Avinesh KumarQuoted 20 lines · Avinesh Kumar
From: Avinesh Kumar <[email protected]>
The write, cachestat, fsync, and cachestat calls were each run as separate
xfs_ioinvocations, closing and reopening the file in between. Some filesystems flush dirty data back onclose(), 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 ...
Quoted 6 lines
Run the whole sequence on one open file descriptor instead by chaining all
xfs_iocommands in single invocation.Suggested-by "Darrick J. Wong" <[email protected]>Signed-off-by Avinesh Kumar <[email protected]>---
This change is good to me,
Quoted 38 lines
tests/generic/798 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)tests/generic/798 +14
-5@@ -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_unmountSignature · 1 line
2.55.0
Re: [PATCH v3] generic/798: chain xfs_io commands into a single invocation
In reply to Avinesh KumarQuoted 20 lines · Avinesh Kumar
From: Avinesh Kumar <[email protected]>
The write, cachestat, fsync, and cachestat calls were each run as separate
xfs_ioinvocations, closing and reopening the file in between. Some filesystems flush dirty data back onclose(), 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 ...
Quoted 5 lines
Run the whole sequence on one open file descriptor instead by chaining all
xfs_iocommands in single invocation.Suggested-by "Darrick J. Wong" <[email protected]>Signed-off-by Avinesh Kumar <[email protected]>
Thanks,
Qu
Quoted 35 lines
--- tests/generic/798 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)tests/generic/798 +14
-5@@ -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