* [PATCH] xfs/841: compare the tree once, after the last mkfs
@ 2026-12-03 15:50 Josef Bacik
2026-12-04 8:29 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2026-12-03 15:50 UTC (permalink / raw)
To: Zorro Lang; +Cc: Darrick J. Wong, fstests, linux-xfs
xfs/841 fails on v7.3-rc7 with xfsprogs 7.2.1 because the first of its
three images differs from the other two:
ERROR: Filesystem images differ!
mkfs.xfs -p copies each regular file by SEEK_DATA and SEEK_HOLE, and for
an unwritten extent lseek reports data wherever the page cache holds a
folio. The test reads every source file between two mkfs runs, so the
runs do not see the same map of those files:
mkfs 1 unwritten ranges with no folio are holes
_test_iteration 1 diff reads each source file and fills the
page cache over those ranges
mkfs 2 the same ranges are data, copied as zeroes
_test_iteration 2 nothing is left to fill
mkfs 3 same map as mkfs 2
In a run that records what lseek reports for each source file around
these steps, the map changes across the first diff in 150 of 940 files
while the extent list of every source file stays the same. 150 files
hold more blocks in the second image, which has 578 fewer free blocks
than the first.
A delalloc extent can change the map in the other direction, since
lseek reports all of it as data until writeback leaves the parts that
never held data unwritten. No run has shown a change from this, but
writeback between two mkfs runs would cause one.
Fix by comparing the directory tree only after the last mkfs run, and
by syncing the test filesystem once fsstress has finished.
Signed-off-by: Josef Bacik <josef@bacik.io>
---
A version of the test with sync -f on the prototype directory where
this one calls _test_sync passed 10 of 10 runs in KVM guests with KASAN
and lockdep: 5 on v7.3-rc7 and 5 on a development branch based on it,
with xfsprogs 7.2.1. This version has not been run, and no run without
the change was made alongside.
---
tests/xfs/841 | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tests/xfs/841 b/tests/xfs/841
index 175e709c701ab..629c68ad68af0 100755
--- a/tests/xfs/841
+++ b/tests/xfs/841
@@ -82,6 +82,12 @@ _create_proto_dir()
-f rmdir=1`
_run_fsstress $FSSTRESS_ARGS
+ # mkfs.xfs -p copies each file by SEEK_DATA/SEEK_HOLE. A delalloc
+ # extent is all data to lseek, but once it is written back the parts
+ # that never held data are unwritten and report as holes. Write
+ # everything back now so that every mkfs run sees the same map.
+ _test_sync
+
# FIFO (named pipe)
mkfifo "$PROTO_DIR/fifo"
@@ -174,14 +180,16 @@ _create_proto_dir
echo "Test: XFS reproducible filesystem image creation"
-# Run three iterations
+# Run three iterations. Compare the directory tree only after the last one:
+# the comparison reads every source file, and lseek reports an unwritten
+# extent as data wherever the page cache holds pages for it, so a mkfs run
+# after the comparison would copy blocks of zeroes that an earlier run left
+# as holes.
hash1=$(_run_iteration 1)
[ -z "$hash1" ] && _fail "Iteration 1 failed"
-_test_iteration 1
hash2=$(_run_iteration 2)
[ -z "$hash2" ] && _fail "Iteration 2 failed"
-_test_iteration 2
hash3=$(_run_iteration 3)
[ -z "$hash3" ] && _fail "Iteration 3 failed"
---
base-commit: 71641219a506ac62bfa231592394265ca812670e
change-id: 20261203-b4-xfs841-compare-once-25ac85599035
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs/841: compare the tree once, after the last mkfs
2026-12-03 15:50 [PATCH] xfs/841: compare the tree once, after the last mkfs Josef Bacik
@ 2026-12-04 8:29 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-12-04 8:29 UTC (permalink / raw)
To: Josef Bacik; +Cc: Zorro Lang, Darrick J. Wong, fstests, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 8:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 15:50 [PATCH] xfs/841: compare the tree once, after the last mkfs Josef Bacik
2026-12-04 8:29 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox