Amir Goldstein [Fri, 14 Nov 2025 19:48:52 +0000 (20:48 +0100)]
overlay: add tests for casefolded layers
Overalyfs did not allow mounting layers with casefold capable fs
until kernel v6.17 and did not allow casefold enabled layers
until kernel v6.18.
Since kernel v6.18, overalyfs allows this kind of setups,
as long as the layers have consistent encoding and all the directories
in the subtree have consistent casefolding.
Create test cases for the following scenarios:
- Mounting overlayfs with casefold disabled
- Mounting overlayfs with casefold enabled
- Lookup subdir in overlayfs with mismatch casefold to parent dir
- Change casefold of underlying subdir while overalyfs is mounted
- Mounting overlayfs with strict enconding, but casefold disabled
- Mounting overlayfs with strict enconding casefold enabled
- Mounting overlayfs with layers with inconsistent UTF8 version
Co-developed-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Chao Yu [Mon, 3 Nov 2025 06:21:43 +0000 (14:21 +0800)]
f2fs: test sanity check condition w/ error injection
After commit 5c1768b67250 ("f2fs: fix to do sanity check correctly on
i_inline_xattr_size"), f2fs should handle corrupted i_inline_xattr_size
correctly, let's add this regression testcase to check that.
Cc: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Chao Yu <chao@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Currently, f2fs/019 and f2fs/020 only clears MKFS_OPTIONS. This causes
the tests to fail when leftover MOUNT_OPTIONS depend on unapplied
MKFS_OPTIONS. So MOUNT_OPTIONS should also be cleared to ensure reliable
mounting.
Joanne Chang [Wed, 12 Nov 2025 13:52:21 +0000 (13:52 +0000)]
f2fs/015: clear MKFS_OPTIONS and MOUNT_OPTIONS
Currently, residual options can interfere with checking the mount
behavior of the listed MKFS_OPTIONS and MOUNT_OPTIONS. For example,
"Option#120: test_dummy_encryption" should fail with the listed
options but succeeds if “MKFS_OPTIONS=encrypt” is preset. By
explicitly clearing MKFS_OPTIONS and MOUNT_OPTIONS, the test’s
reliability can be improved.
f2fs/015.out is also updated to expect failure for cases that require
additional mkfs attributes to mount.
Darrick J. Wong [Mon, 10 Nov 2025 18:27:51 +0000 (10:27 -0800)]
generic/774: turn off lfsr
This test fails mostly-predictably across my testing fleet with:
--- /run/fstests/bin/tests/generic/774.out 2025-10-20 10:03:43.432910446 -0700
+++ /var/tmp/fstests/generic/774.out.bad 2025-11-10 01:14:58.941775866 -0800
@@ -1,2 +1,11 @@
QA output created by 774
+fio: failed initializing LFSR
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 0, length 33554432 (requested block: offset=0, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 33554432, length 33554432 (requested block: offset=33554432, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 67108864, length 33554432 (requested block: offset=67108864, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 100663296, length 33554432 (requested block: offset=100663296, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 134217728, length 33554432 (requested block: offset=134217728, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 167772160, length 33554432 (requested block: offset=167772160, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 201326592, length 33554432 (requested block: offset=201326592, length=33554432)
+verify: bad magic header 0, wanted acca at file /opt/test-file offset 234881024, length 33554432 (requested block: offset=234881024, length=33554432)
Silence is golden
I'm not sure why the linear feedback shift register algorithm is
specifically needed for this test.
Cc: fstests@vger.kernel.org # v2025.10.20 Fixes: 9117fb93b41c38 ("generic: Add atomic write test using fio verify on file mixed mappings") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:27:35 +0000 (10:27 -0800)]
generic/774: reduce file size
We've gotten complaints about this test taking hours to run and
producing stall warning on test VMs with a large number of cpu cores. I
think this is due to the maximum atomic write unit being very large on
XFS where we can fall back to a software-based out of place write
implementation.
On the victim machine, the atomic write max is 4MB and there are 24
CPUs. As a result, aw_bsize to be 1MB, so the file size is
1MB * 24 * 2 * 100 == 4.8GB. I set up a test machine with fast storage
and 24 CPUs, and the atomic writes poked along at 25MB/s and the total
runtime was 300s. On spinning rust those stats will be much worse.
Let's try backing the file size off by 10x and see if that eases the
complaints.
Cc: fstests@vger.kernel.org # v2025.10.20 Fixes: 9117fb93b41c38 ("generic: Add atomic write test using fio verify on file mixed mappings") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:27:20 +0000 (10:27 -0800)]
xfs/837: fix test to work with pre-metadir quota mount options
Prior to metadir, xfs users always had to supply quota mount options to
get quota functionality, even if the mount options match the ondisk
superblock's qflag state. The kernel, in turn, required a writable
filesystem if any mount options were specified. As a result, this test
fails on those old filesystems because the _scratch_mount fails.
Metadir filesystems reuse whatever's in qflags if no mount options are
supplied, so we don't need them in MOUNT_OPTS anymore.
Change the _scratch_mount to _try_scratch_mount and add configurable
golden output to handle this case.
Cc: fstests@vger.kernel.org # v2025.06.22 Fixes: e225772353e212 ("xfs: add mount test for read only rt devices") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:27:04 +0000 (10:27 -0800)]
generic/019: skip test when there is no journal
This test checks a filesystem's ability to recover from a noncritical
disk failure (e.g. journal replay) without becoming inconsistent. This
isn't true for any filesystem that doesn't have a journal, so we should
skip the test on those platforms.
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:26:48 +0000 (10:26 -0800)]
generic/778: fix background loop control with sentinel files
This test fails on my slowish QA VM with 32k-fsblock xfs:
--- /run/fstests/bin/tests/generic/778.out 2025-10-20 10:03:43.432910446 -0700
+++ /var/tmp/fstests/generic/778.out.bad 2025-11-04 12:01:31.137813652 -0800
@@ -1,2 +1,137 @@
QA output created by 778
-Silence is golden
+umount: /opt: target is busy.
+mount: /opt: /dev/sda4 already mounted on /opt.
+ dmesg(1) may have more information after failed mount system call.
+cycle mount failed
+(see /var/tmp/fstests/generic/778.full for details)
Injecting a 'ps auxfww' into the _scratch_cycle_mount helper reveals
that this process is still sitting on /opt:
Yes, that's the xfs_io process started by atomic_write_loop.
Inexplicably, the awloop killing code terminates the subshell running
the for loop in atomic_write_loop but only waits for the subshell itself
to exit. It doesn't wait for any of that subshell's children, and
that's why the unmount fails.
A bare "wait" (without the $awloop_pid parameter) also doesn't wait for
the xfs_io because the parent shell sees the subshell exit and treats
that as job completion. We can't use killall here because the system
could be running check-parallel, nor can we use pkill here because the
pid namespace containment code was removed.
The simplest stupid answer is to use sentinel files to control the loop.
Cc: fstests@vger.kernel.org # v2025.10.20 Fixes: ca954527ff9d97 ("generic: Add sudden shutdown tests for multi block atomic writes") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:26:32 +0000 (10:26 -0800)]
generic/778: fix severe performance problems
This test takes 4800s to run, which is horrible. AFAICT it starts out
by timing how much can be written atomically to a new file in 0.2
seconds, then scales up the file size by 3x. On not very fast storage,
this can result in file_size being set to ~250MB on a 4k fsblock
filesystem. That's about 64,000 blocks.
The next thing this test does is try to create a file of that size
(250MB) of alternating written and unwritten blocks. For some reason,
it sets up this file by invoking xfs_io 64,000 times to write small
amounts of data, which takes 3+ minutes on the author's system because
exec overhead is pretty high when you do that.
As a result, one loop through the test takes almost 4 minutes. The test
loops 20 times, so it runs for 80 minutes(!!) which is a really long
time.
So the first thing we do is observe that the giant slow loop is being
run as a single thread on an empty filesystem. Most of the time the
allocator generates a mostly physically contiguous file. We could
fallocate the whole file instead of fallocating one block every other
time through the loop. This halves the setup time.
Next, we can also stuff the remaining pwrite commands into a bash array
and only invoke xfs_io once every 128x through the loop. This amortizes
the xfs_io startup time, which reduces the test loop runtime to about 20
seconds.
Finally, replace the 20x loop with a _soak_loop_running 5x loop because
5 seems like enough. Anyone who wants more can set TIME_FACTOR or
SOAK_DURATION to get more intensive testing. On my system this cuts the
runtime to 75 seconds.
Cc: fstests@vger.kernel.org # v2025.10.20 Fixes: ca954527ff9d97 ("generic: Add sudden shutdown tests for multi block atomic writes") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Darrick J. Wong [Mon, 10 Nov 2025 18:26:17 +0000 (10:26 -0800)]
common: leave any breadcrumbs when _link_out_file_named can't find the output file
_link_out_file_named is an obnoxiously complicated helper involving a
perl script embedded inside a bash subshell that does ... a lookup of
some sort involving comparing the comma-separated list in its second
argument against a comma-separated list in a config file that then maps
to an output file suffix. I don't know what it really does. The .cfg
file format is undocumented except for the perl script.
This is really irritating every time I have to touch any of these tests
with flexible golden outputs, and I frequently screw up the mapping.
The helper is not very helpful when you do this, because it doesn't even
try to tell you *which* suffix it found, let alone how it got there.
Fix this up so that the .full file gets some diagnostics, even if the
stdout text is "no qualified output".
Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Theodore Ts'o [Fri, 14 Nov 2025 01:02:38 +0000 (20:02 -0500)]
generic/773: fix expected output "QA output created by 1226"
The test generic/773 was apparently submitted as generic/1226, but
when it was renamed to pack the test namespace, apparently the test
output wasn't adjusted to reflect the new test name, leading to the
test failing on sytems that have devices that support atomic writes.
Fixes: 1499d4ff2365 ("generic: Add atomic write test using fio crc ...") Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>