]> www.infradead.org Git - users/hch/xfstests-dev.git/log
users/hch/xfstests-dev.git
5 months agoxfs: handle internal rtdev in the _require_ helpers xfs-zoned-2024-21-07
Christoph Hellwig [Thu, 31 Oct 2024 17:58:23 +0000 (18:58 +0100)]
xfs: handle internal rtdev in the _require_ helpers

.. and add it to a few more tests where it matters for the main device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
5 months agoxfs: xfs_copy doens't like RT sections
Christoph Hellwig [Thu, 31 Oct 2024 17:58:00 +0000 (18:58 +0100)]
xfs: xfs_copy doens't like RT sections

internal or external..

Signed-off-by: Christoph Hellwig <hch@lst.de>
5 months agoxfs: not quota support with internal rtdev
Christoph Hellwig [Thu, 31 Oct 2024 07:45:21 +0000 (08:45 +0100)]
xfs: not quota support with internal rtdev

Same as regular zoned, but the previous check didn't work.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: add a _require_scratch_non_zoned helper
Christoph Hellwig [Thu, 24 Oct 2024 11:50:09 +0000 (13:50 +0200)]
xfs: add a _require_scratch_non_zoned helper

Certain tests can't run on zoned file systems.  Add a helper to
_notrun them in this case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: handle zoned file systems in _scratch_xfs_force_no_metadir
Christoph Hellwig [Thu, 24 Oct 2024 11:26:25 +0000 (13:26 +0200)]
xfs: handle zoned file systems in _scratch_xfs_force_no_metadir

zoned file systems required the metadir feature.  If the tests are run
on a conventional block device as the RT device, we can simply remove
the zoned flag an run the test, but if the RT device sits on a zoned
block device there is no way to run a test that wants a non-metadir
file system.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: add a zoned growfs test
Christoph Hellwig [Wed, 23 Oct 2024 11:33:10 +0000 (13:33 +0200)]
xfs: add a zoned growfs test

Zoned file systems require zone aligned RT volume sizes.  Because of
that xfs/596 won't work as-is.  Copy it and test two zone capacity
aligned values.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: remove the post-EOF prealloc tests from the auto and quick groups
Christoph Hellwig [Wed, 23 Oct 2024 10:38:30 +0000 (12:38 +0200)]
xfs: remove the post-EOF prealloc tests from the auto and quick groups

These fail for various non-default configs like DAX, alwayscow and
small block sizes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: fix checks for RT quotas
Christoph Hellwig [Tue, 22 Oct 2024 12:08:08 +0000 (14:08 +0200)]
xfs: fix checks for RT quotas

_require_rtquota doesn't seem to _notrun the test for kernels without
CONFIG_XFS_QUOTA for me. It also seems to duplicate the existing
_scratch_supports_rtquota feature.

Switch to that plus using _try_scratch_mount to catch mount failures
with CONFIG_XFS_QUOTA disabled.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: test that xfs_repair does not mess up the zone used counter
Christoph Hellwig [Tue, 22 Oct 2024 08:58:49 +0000 (10:58 +0200)]
xfs: test that xfs_repair does not mess up the zone used counter

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: add a test for zoned block accounting after remount
Christoph Hellwig [Tue, 22 Oct 2024 07:41:56 +0000 (09:41 +0200)]
xfs: add a test for zoned block accounting after remount

Test for a problem with an earlier version of the zoned XFS mount code
where freeded blocks in an open zone weren't properly accounted for.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs/596: require non-zoned rt device
Hans Holmberg [Mon, 14 Oct 2024 12:22:21 +0000 (12:22 +0000)]
xfs/596: require non-zoned rt device

We don't support growfs for zoned rt devices, so skip the test in
stead of failing.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
6 months agoxfs/177: force a small file system size
Christoph Hellwig [Sun, 18 Aug 2024 04:52:39 +0000 (06:52 +0200)]
xfs/177: force a small file system size

This test make assumptions about the number of metadata inodes.  When
using small realtime group size (e.g. the customary 256MB for SMR
hard drives) this assumption gets violated even with modest file system
size.  Force a small file system size to side-step this issue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: check for zoned-specific errors in _try_scratch_mkfs_xfs
Christoph Hellwig [Wed, 21 Feb 2024 16:15:48 +0000 (17:15 +0100)]
xfs: check for zoned-specific errors in _try_scratch_mkfs_xfs

Check for a few errors issued for unsupported zoned configurations in
_try_scratch_mkfs_xfs so that the test is not run instead of failed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agoxfs: add _require_non_zoned_device calls
Christoph Hellwig [Mon, 26 Aug 2024 07:30:35 +0000 (09:30 +0200)]
xfs: add _require_non_zoned_device calls

Add _require_non_zoned_device calls to various XFS-specific tests.
Mostly this is because they force v4 file systems or other features
that can't work on zoned devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agocommon: allow _require_non_zoned_device without an argument
Christoph Hellwig [Wed, 21 Feb 2024 16:28:48 +0000 (17:28 +0100)]
common: allow _require_non_zoned_device without an argument

That way it can also be used for RT and log devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agocommon: extend the zoned device checks in _require_dm_target
Christoph Hellwig [Wed, 8 Nov 2023 06:36:05 +0000 (07:36 +0100)]
common: extend the zoned device checks in _require_dm_target

Also check for zoned log and rt devices in _require_dm_target

Signed-off-by: Christoph Hellwig <hch@lst.de>
6 months agocommon/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section
Darrick J. Wong [Tue, 6 Feb 2024 00:06:50 +0000 (16:06 -0800)]
common/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section

It's possible for the sysadmin to set rtinherit on the directory tree
even if there isn't a realtime section attached to the filesystem.  When
this is the case, the realtime flag is /not/ passed to new files, and
file data is written to the data device.  The file allocation unit for
the file is the fs blocksize, and it is not correct to use the rt
extent.

fstests can be fooled into doing the incorrect thing if test runner puts
'-d rtinherit=1 -r extsize=28k' into MKFS_OPTIONS without configuring a
realtime device.  This causes many tests to do the wrong thing because
they think they must operate on units of 28k (and not 4k).  Fix this.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agogeneric/331,xfs/240: support files that skip delayed allocation
Darrick J. Wong [Tue, 6 Feb 2024 00:06:50 +0000 (16:06 -0800)]
generic/331,xfs/240: support files that skip delayed allocation

The goal of this test is to ensure that log recovery finishes a copy on
write operation in the event of temporary media errors.  It's important
that the test observe some sort of IO error once we switch the scratch
device to fail all IOs, but regrettably the test encoded the specific
behavior of XFS and btrfs when the test was written -- the aio write
to the page cache doesn't have to touch the disk and succeeds, and the
fdatasync flushes things to disk and hits the IO error.

However, this is not how things work on the XFS realtime device.  There
is no delalloc on realtime, so the aio write allocates an unwritten
extent to stage the write.  The allocation fails due to EIO, so it's the
write call that fails.  Therefore, all we need to do is to detect an IO
error at any point between the write and the fdatasync call to be
satisfied that the test does what we want to do.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: remove xfs/131 now that we allow reflink on realtime volumes
Darrick J. Wong [Tue, 6 Feb 2024 00:06:49 +0000 (16:06 -0800)]
xfs: remove xfs/131 now that we allow reflink on realtime volumes

Remove this test, since we now support reflink on the rt volume.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: race fsstress with realtime refcount btree scrub and repair
Darrick J. Wong [Tue, 6 Feb 2024 00:06:49 +0000 (16:06 -0800)]
xfs: race fsstress with realtime refcount btree scrub and repair

Race checking and rebuilding realtime refcount btrees with fsstress.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/27[24]: adapt for checking files on the realtime volume
Darrick J. Wong [Tue, 6 Feb 2024 00:06:49 +0000 (16:06 -0800)]
xfs/27[24]: adapt for checking files on the realtime volume

Adapt both tests to behave properly if the two files being tested are on
the realtime volume.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: create fuzz tests for the realtime refcount btree
Darrick J. Wong [Tue, 6 Feb 2024 00:06:48 +0000 (16:06 -0800)]
xfs: create fuzz tests for the realtime refcount btree

Create fuzz tests for the realtime refcount btree record and key/ptr
blocks.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/populate: create realtime refcount btree
Darrick J. Wong [Tue, 6 Feb 2024 00:06:48 +0000 (16:06 -0800)]
common/populate: create realtime refcount btree

Populate a realtime refcount btree when we're creating a sample fs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: update fields for realtime reflink
Darrick J. Wong [Tue, 6 Feb 2024 00:06:48 +0000 (16:06 -0800)]
xfs/122: update fields for realtime reflink

Add a few more ondisk structures for realtime reflink.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agofuzzy: create missing fuzz tests for rt rmap btrees
Darrick J. Wong [Tue, 6 Feb 2024 00:06:47 +0000 (16:06 -0800)]
fuzzy: create missing fuzz tests for rt rmap btrees

Back when I first created the fuzz tests for the realtime rmap btree, I
forgot a couple of things.  Add tests to fuzz rtrmap btree leaf records,
and node keys.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agopopulate: check that we created a realtime rmap btree of the given height
Darrick J. Wong [Tue, 6 Feb 2024 00:06:47 +0000 (16:06 -0800)]
populate: check that we created a realtime rmap btree of the given height

Make sure that we actually create an rt rmap btree of the desired height
somewhere in the filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agopopulate: adjust rtrmap calculations for rtgroups
Darrick J. Wong [Tue, 6 Feb 2024 00:06:47 +0000 (16:06 -0800)]
populate: adjust rtrmap calculations for rtgroups

Now that we've sharded the realtime volume and created per-group rmap
btrees, we need to adjust downward the size of rtrmapbt records since
the block counts are now 32-bit instead of 64-bit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/443: use file allocation unit, not dbsize
Darrick J. Wong [Tue, 6 Feb 2024 00:06:47 +0000 (16:06 -0800)]
xfs/443: use file allocation unit, not dbsize

We can only punch in units of file allocation boundaries, so update this
test to use that instead of the fs blocksize.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: skip tests if formatting small filesystem fails
Darrick J. Wong [Tue, 6 Feb 2024 00:06:46 +0000 (16:06 -0800)]
xfs: skip tests if formatting small filesystem fails

There are a few tests that try to exercise XFS functionality with an
unusually small (< 500MB) filesystem.  Formatting can fail if the test
configuration also specifies a very large realtime device because mkfs
hits ENOSPC when allocating the realtime metadata.  The test proceeds
anyway (which causes an immediate mount failure) so we might as well
skip these.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/3{43,32}: adapt tests for rt extent size greater than 1
Darrick J. Wong [Tue, 6 Feb 2024 00:06:46 +0000 (16:06 -0800)]
xfs/3{43,32}: adapt tests for rt extent size greater than 1

Both of these tests for the realtime volume can fail when the rt extent
size is larger than a single block.

332 is a read-write functionality test that encodes md5sum in the
output, so we need to skip it if $blksz isn't congruent with the extent
size, because the fcollapse call will fail.

343 is a test of the rmap btree, so the fix here is simpler -- make
$blksz the file allocation unit, and get rid of the md5sum in the
golden output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/341: update test for rtgroup-based rmap
Darrick J. Wong [Tue, 6 Feb 2024 00:06:46 +0000 (16:06 -0800)]
xfs/341: update test for rtgroup-based rmap

Now that we're sharding the realtime volume into multiple allocation
groups, update this test to reflect the new reality.  The realtime rmap
btree record and key sizes have shrunk, and we can't guarantee that a
quick file write actually hits the same rt group as the one we fuzzed,
so eliminate the file write test since we're really only curious if
xfs_repair will fix the problem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: fix various problems with fsmap detecting the data device
Darrick J. Wong [Tue, 6 Feb 2024 00:06:46 +0000 (16:06 -0800)]
xfs: fix various problems with fsmap detecting the data device

Various tests of realtime rmap functionality assumed that the data
device could be picked out from the GETFSMAP output by looking for
static fs metadata.  This is no longer true, since rtgroups have a
static superblock header at the start, so update these tests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: update for rtgroups-based realtime rmap btrees
Darrick J. Wong [Tue, 6 Feb 2024 00:06:45 +0000 (16:06 -0800)]
xfs/122: update for rtgroups-based realtime rmap btrees

Now that we've redesigned realtime rmap to require that the rt section
be sharded into allocation groups of no more than 2^31 blocks, we've
reduced the size of the ondisk structures and therefore need to update
this test.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: race fsstress with realtime rmap btree scrub and repair
Darrick J. Wong [Tue, 6 Feb 2024 00:06:45 +0000 (16:06 -0800)]
xfs: race fsstress with realtime rmap btree scrub and repair

Race checking and rebuilding realtime rmap btrees with fsstress.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agofuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file
Darrick J. Wong [Tue, 6 Feb 2024 00:06:45 +0000 (16:06 -0800)]
fuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file

The fs population code creates a realtime rmap btree in /some/ realtime
group with at least two levels.  This rmapbt file isn't necessarily the
one for group 0, so we need to find it programmatically.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: fix tests that try to access the realtime rmap inode
Darrick J. Wong [Tue, 6 Feb 2024 00:06:44 +0000 (16:06 -0800)]
xfs: fix tests that try to access the realtime rmap inode

The realtime rmap tests were added to fstests a long time ago.  Since
they were added, we decided to create a metadata file directory
structure instead of adding more fields to the superblock.  Therefore,
fix all the tests that try to access these paths.

While we're at it, fix xfs/409 to run the *online* scrub program like
it's supposed to.  xfs/408 is the fuzzer for xfs_repair testing.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: regression testing of quota on the realtime device
Darrick J. Wong [Tue, 6 Feb 2024 00:06:53 +0000 (16:06 -0800)]
xfs: regression testing of quota on the realtime device

Make sure that quota accounting and enforcement work correctly for
realtime volumes on XFS.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: fix quota tests to adapt to realtime quota
Darrick J. Wong [Tue, 6 Feb 2024 00:06:52 +0000 (16:06 -0800)]
xfs: fix quota tests to adapt to realtime quota

Fix or limit the scope of tests so that we can turn on testing for
realtime quotas.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon: enable testing of realtime quota when supported
Darrick J. Wong [Tue, 6 Feb 2024 00:06:52 +0000 (16:06 -0800)]
common: enable testing of realtime quota when supported

If the kernel advertises realtime quota support, test it.

However, this has a plot twist -- because rt quota only works if the xfs
is formatted with rtgroups, we have to mount a filesystem to see if
rtquota is actually supported.  Since it's time consuming to format and
mount the scratch filesystem, we'll assume that the test and scratch
fses have the same support.

This will cause problems if one sets SCRATCH_RTDEV but not TEST_RTDEV.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: fix tests for persistent qflags
Darrick J. Wong [Thu, 22 Aug 2024 00:30:21 +0000 (17:30 -0700)]
xfs: fix tests for persistent qflags

Fix the tests that now break with persistent quota flags.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: test persistent quota flags
Darrick J. Wong [Thu, 22 Aug 2024 00:03:06 +0000 (17:03 -0700)]
xfs: test persistent quota flags

Test the persistent quota flags that come with the metadir feature.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: update tests for quota files in the metadir
Darrick J. Wong [Tue, 20 Aug 2024 23:53:08 +0000 (16:53 -0700)]
xfs: update tests for quota files in the metadir

Update fstests to handle quota files in the metadir.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: update for segmented rtblock addresses
Darrick J. Wong [Fri, 27 Sep 2024 16:47:28 +0000 (09:47 -0700)]
xfs/122: update for segmented rtblock addresses

Check the offset of sb_rgblklog.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: fix fuzz tests of rtgroups bitmap and summary files
Darrick J. Wong [Tue, 13 Aug 2024 17:22:27 +0000 (10:22 -0700)]
xfs: fix fuzz tests of rtgroups bitmap and summary files

With rtgroups, the rt bitmap and summary files are now per-group, so
adjust the fuzz and fsck tests to find the new locations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/fuzzy: adapt the scrub stress tests to support rtgroups
Darrick J. Wong [Tue, 6 Feb 2024 00:06:43 +0000 (16:06 -0800)]
common/fuzzy: adapt the scrub stress tests to support rtgroups

Adapt the scrub stress testing framework to support checking realtime
group metadata.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/xfs: capture realtime devices during metadump/mdrestore
Darrick J. Wong [Tue, 6 Feb 2024 00:06:43 +0000 (16:06 -0800)]
common/xfs: capture realtime devices during metadump/mdrestore

If xfs_metadump supports the -r switch to capture the contents of
realtime devices and there is a realtime device, add the option to the
command line to enable preservation.

Similarly, if the dump file could restore to an external scratch rtdev,
pass the -r option to mdrestore so that we can restore rtdev contents.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands
Darrick J. Wong [Tue, 6 Feb 2024 00:06:43 +0000 (16:06 -0800)]
xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands

Fix these tests to deal with the xfs_io bmap and fsmap commands printing
out realtime group numbers if the feature is enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: update for rtbitmap headers
Darrick J. Wong [Tue, 6 Feb 2024 00:06:42 +0000 (16:06 -0800)]
xfs/122: update for rtbitmap headers

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/449: update test to know about xfs_db -R
Darrick J. Wong [Tue, 6 Feb 2024 00:06:42 +0000 (16:06 -0800)]
xfs/449: update test to know about xfs_db -R

The realtime groups feature added a -R flag to xfs_db so that users can
pass in the realtime device.  Since we've now modified the
_scratch_xfs_db to use this facility, we can update the test to do exact
comparisons of the xfs_db info command against the mkfs output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/185: update for rtgroups
Darrick J. Wong [Tue, 6 Feb 2024 00:06:42 +0000 (16:06 -0800)]
xfs/185: update for rtgroups

This old test is a bit too fixated on exact rt allocator behavior.  With
rtgroups enabled, we can end up with one large contiguous region that's
split into multiple bmbt mappings to avoid crossing rtgroup boundaries.
The realtime superblock throws another twist into the mix because the
first rtx will always be in use, which can shift the start of the
physical space mappings by up to 1 rtx.

Also fix a bug where we'd try to fallocate the total number of rtx,
whereas we should be asking for the number of free rtx to avoid ENOSPC
errors.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon: pass the realtime device to xfs_db when possible
Darrick J. Wong [Tue, 6 Feb 2024 00:06:42 +0000 (16:06 -0800)]
common: pass the realtime device to xfs_db when possible

Teach xfstests to pass the realtime device to xfs_db when it supports
that option.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/206: update mkfs filtering for rt groups feature
Darrick J. Wong [Tue, 6 Feb 2024 00:06:41 +0000 (16:06 -0800)]
xfs/206: update mkfs filtering for rt groups feature

Filter out the new mkfs lines that show the rtgroup information, since
this test is heavily dependent on old mkfs output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agopunch-alternating: detect xfs realtime files with large allocation units
Darrick J. Wong [Tue, 6 Feb 2024 00:06:41 +0000 (16:06 -0800)]
punch-alternating: detect xfs realtime files with large allocation units

For files on the XFS realtime volume, it's possible that the file
allocation unit (aka the minimum size we have to punch to deallocate
file blocks) could be greater than a single fs block.  This utility
assumed that it's always possible to punch a single fs block, but for
these types of files, all that does is zeroes the page cache.  While
that's what most *user applications* want, fstests uses punching to
fragment file mapping metadata and/or fragment free space, so adapt this
test for that purpose by detecting realtime files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: update for rtgroups
Darrick J. Wong [Tue, 6 Feb 2024 00:06:41 +0000 (16:06 -0800)]
xfs/122: update for rtgroups

Add our new metadata for realtime allocation groups to the ondisk checking.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/populate: use metadump v2 format by default for fs metadata snapshots
Darrick J. Wong [Tue, 6 Feb 2024 00:06:41 +0000 (16:06 -0800)]
common/populate: use metadump v2 format by default for fs metadata snapshots

When we're snapshotting filesystem metadata after creating a populated
filesystem, force the creation of metadump v2 files by default to
exercise the new format, since xfs_metadump continues to use the v1
format unless told otherwise.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/ext4: reformat external logs during mdrestore operations
Darrick J. Wong [Tue, 6 Feb 2024 00:06:40 +0000 (16:06 -0800)]
common/ext4: reformat external logs during mdrestore operations

The e2image file format doesn't support the capture of external log
devices, which means that mdrestore ought to reformat the external log
to get the restored filesystem to work again.  The common/populate code
could already do this, so push it to the common ext4 helper.

While we're at it, fix the uncareful usage of SCRATCH_LOGDEV in the
populate code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agofuzzy: stress data and rt sections of xfs filesystems equally
Darrick J. Wong [Tue, 6 Feb 2024 00:06:58 +0000 (16:06 -0800)]
fuzzy: stress data and rt sections of xfs filesystems equally

If we're stress-testing scrub on a realtime filesystem, make sure that
we run fsstress on separate directory trees for data and realtime
workouts.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/{fuzzy,populate}: use _scratch_xfs_mdrestore
Darrick J. Wong [Tue, 6 Feb 2024 00:06:40 +0000 (16:06 -0800)]
common/{fuzzy,populate}: use _scratch_xfs_mdrestore

Port the fuzzing and populated filesystem cache code to use this helper
to pick up external log devices for the scratch filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/populate: refactor caching of metadumps to a helper
Darrick J. Wong [Tue, 6 Feb 2024 00:06:40 +0000 (16:06 -0800)]
common/populate: refactor caching of metadumps to a helper

Hoist out of _scratch_populate_cached all the code that we use to save a
metadump of the populated filesystem.  We're going to make this more
involved for XFS in the next few patches so that we can take advantage
of the new support for external devices in metadump/mdrestore.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: test metapath repairs
Darrick J. Wong [Tue, 6 Feb 2024 00:06:40 +0000 (16:06 -0800)]
xfs: test metapath repairs

Functional testing for metadir path checking and repairs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/163: bigger fs for metadir
Darrick J. Wong [Wed, 21 Aug 2024 00:21:15 +0000 (17:21 -0700)]
xfs/163: bigger fs for metadir

Adjust filesystem size up so we can pass this test even with metadir
and rtgroups enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: create fuzz tests for metadata directories
Darrick J. Wong [Tue, 6 Feb 2024 00:06:39 +0000 (16:06 -0800)]
xfs: create fuzz tests for metadata directories

Create fuzz tests to make sure that all the validation works for
metadata directories and subdirectories.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: adjust for metadata directories
Darrick J. Wong [Thu, 27 Jun 2024 17:10:46 +0000 (10:10 -0700)]
xfs/122: adjust for metadata directories

Adjust this test for the metadir feature.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/509: adjust inumbers accounting for metadata directories
Darrick J. Wong [Tue, 6 Feb 2024 00:06:39 +0000 (16:06 -0800)]
xfs/509: adjust inumbers accounting for metadata directories

The INUMBERS ioctl exports data from the inode btree directly -- the
number of inodes it reports is taken from ir_freemask and includes all
the files in the metadata directory tree.  BULKSTAT, on the other hand,
only reports non-metadata files.  When metadir is enabled, this will
(eventually) cause a discrepancy in the inode counts that is large
enough to exceed the tolerances, thereby causing a test failure.

Correct this by counting the files in the metadata directory and
subtracting that from the INUMBERS totals.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/{050,144,153,299,330}: update quota reports to handle metadir trees
Darrick J. Wong [Tue, 6 Feb 2024 00:06:38 +0000 (16:06 -0800)]
xfs/{050,144,153,299,330}: update quota reports to handle metadir trees

Prior to the new metadir feature in XFS, the rtbitmap and rtsummary
files were included in icount, though their bcount contribution is zero
due to rt and quota not being supported together.  With the new metadir
feature in XFS, no files in the metadata directory tree are counted in
quota.

Hence we must adjust the icount of any quota report down by two to avoid
breaking golden outputs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/206: update for metadata directory support
Darrick J. Wong [Tue, 6 Feb 2024 00:06:38 +0000 (16:06 -0800)]
xfs/206: update for metadata directory support

Filter 'metadir=' out of the golden output so that metadata directories
don't cause this test to regress.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/repair: patch up repair sb inode value complaints
Darrick J. Wong [Tue, 6 Feb 2024 00:06:38 +0000 (16:06 -0800)]
common/repair: patch up repair sb inode value complaints

Now that we've refactored xfs_repair to be more consistent in how it
reports unexpected superblock inode pointer values, we have to fix up
the fstests repair filters to emulate the old golden output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/{030,033,178}: forcibly disable metadata directory trees
Darrick J. Wong [Tue, 6 Feb 2024 00:06:38 +0000 (16:06 -0800)]
xfs/{030,033,178}: forcibly disable metadata directory trees

The golden output for thests tests encode the xfs_repair output when we
fuzz various parts of the filesystem.  With metadata directory trees
enabled, however, the golden output changes dramatically to reflect
reconstruction of the metadata directory tree.

To avoid regressions, add a helper to force metadata directories off via
MKFS_OPTIONS.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agovarious: fix finding metadata inode numbers when metadir is enabled
Darrick J. Wong [Tue, 6 Feb 2024 00:06:37 +0000 (16:06 -0800)]
various: fix finding metadata inode numbers when metadir is enabled

There are a number of tests that use xfs_db to examine the contents of
metadata inodes to check correct functioning.  The logic is scattered
everywhere and won't work with metadata directory trees, so make a
shared helper to find these inodes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/122: fix metadirino
Darrick J. Wong [Tue, 6 Feb 2024 00:06:37 +0000 (16:06 -0800)]
xfs/122: fix metadirino

Fix xfs/122 to work properly with metadirino.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs: test upgrading old features
Darrick J. Wong [Tue, 6 Feb 2024 00:06:33 +0000 (16:06 -0800)]
xfs: test upgrading old features

Test the ability to add older v5 features.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agofsstress: add support for FALLOC_FL_UNSHARE_RANGE
Darrick J. Wong [Wed, 2 Oct 2024 21:08:32 +0000 (14:08 -0700)]
fsstress: add support for FALLOC_FL_UNSHARE_RANGE

Teach fsstress to try to unshare file blocks on filesystems, seeing how
the recent addition to fsx has uncovered a lot of bugs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
6 months agoxfs/122: add tests for commitrange structures
Darrick J. Wong [Fri, 29 Mar 2024 20:29:52 +0000 (13:29 -0700)]
xfs/122: add tests for commitrange structures

Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agomisc: amend unicode confusing name tests to check for hidden tag characters
Darrick J. Wong [Tue, 15 Oct 2024 17:49:02 +0000 (10:49 -0700)]
misc: amend unicode confusing name tests to check for hidden tag characters

The Unicode consortium has twice defined (and later deprecated) special
"tag" codepoints.  These tag codepoints are not supposed to be rendered
(i.e. they're invisible) but you can certainly encode them in
directories and labels to try to confuse users.

xfs_scrub already knows how complain about these tag characters because
libicu can detect both their presence and their use in confusing name
attacks, so add this as an explicit regression test.

Link: https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
Link: https://arstechnica.com/security/2024/10/ai-chatbots-can-read-and-write-invisible-text-creating-an-ideal-covert-channel/
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agoxfs/161: adapt the test case for LBS filesystem
Pankaj Raghav [Tue, 6 Feb 2024 00:06:59 +0000 (16:06 -0800)]
xfs/161: adapt the test case for LBS filesystem

This test fails for >= 64k filesystem block size on a 4k PAGE_SIZE
system(see LBS efforts[1]). Adapt the blksz so that we create more than
one block for the testcase.

Cap the blksz to be at least 64k to retain the same behaviour as before
for smaller filesystem blocksizes.

[1] LBS effort: https://lore.kernel.org/lkml/20230915183848.1018717-1-kernel@pankajraghav.com/

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agocommon/xfs: _notrun tests that fail due to block size < sector size
Darrick J. Wong [Tue, 6 Feb 2024 00:06:58 +0000 (16:06 -0800)]
common/xfs: _notrun tests that fail due to block size < sector size

It makes no sense to fail a test that failed to format a filesystem with
a block size smaller than the sector size since the test preconditions
are not valid.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
6 months agosrc/fiexchange.h: add the start-commit/commit-range ioctls
Darrick J. Wong [Tue, 1 Oct 2024 16:49:11 +0000 (09:49 -0700)]
src/fiexchange.h: add the start-commit/commit-range ioctls

Add these two ioctls as well, since they're a part of the file content
exchange functionality.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agofsstress: add support for FALLOC_FL_UNSHARE_RANGE
Darrick J. Wong [Thu, 10 Oct 2024 10:07:38 +0000 (18:07 +0800)]
fsstress: add support for FALLOC_FL_UNSHARE_RANGE

Teach fsstress to try to unshare file blocks on filesystems, seeing how
the recent addition to fsx has uncovered a lot of bugs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agocommon/config: fix RECREATE_TEST_DEV initialization
Daniel Gomez [Sun, 30 Jun 2024 21:52:40 +0000 (23:52 +0200)]
common/config: fix RECREATE_TEST_DEV initialization

Do not allow the overwriting of the RECREATE_TEST_DEV variable. When
this variable is enabled, common/rc -> common/config will reset it
to false after the test device recreation process. This allows for
differentiation in mount options for SCRATCH and TEST.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agocommon/populate: fix bash syntax error in _fill_fs
Darrick J. Wong [Tue, 1 Oct 2024 16:48:56 +0000 (09:48 -0700)]
common/populate: fix bash syntax error in _fill_fs

In bash, one does not set a variable by prepending the dollar sign to
the variable name.  Amazingly, this was copied verbatim from generic/256
in 2016 and hasn't been caught since its introduction in 2011. :(

Cc: allison.henderson@oracle.com
Fixes: 815015e9ee ("generic: make 17[1-4] work well when btrfs compression is enabled")
Fixes: b55fb0807c ("xfstests: Add ENOSPC Hole Punch Test")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agobtrfs/315: update filter to match mount cmd
An Long [Fri, 11 Oct 2024 06:12:16 +0000 (14:12 +0800)]
btrfs/315: update filter to match mount cmd

Mount error info changed since util-linux v2.40
(91ea38e libmount: report failed syscall name).
So update _filter_mount_error() to match it.

Signed-off-by: An Long <lan@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agobtrfs/322: add git commit ID
Filipe Manana [Mon, 7 Oct 2024 12:02:16 +0000 (13:02 +0100)]
btrfs/322: add git commit ID

The corresponding btrfs kernel patch was merged into Linus' tree and
included in kernel 6.12-rc2, so update the test with the commit ID.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agobtrfs: update some tests to be able to run with btrfs-progs v6.11
Filipe Manana [Mon, 7 Oct 2024 11:32:50 +0000 (12:32 +0100)]
btrfs: update some tests to be able to run with btrfs-progs v6.11

In btrfs-progs v6.11 the output of the "filesystem show" command changed
so that it no longers prints blank lines. This happened with commit
4331bfb011bd ("btrfs-progs: fi show: remove stray newline in filesystem
show").

We have some tests that expect the blank lines in their golden output,
and therefore they fail with btrfs-progs v6.11.

So update the filter _filter_btrfs_filesystem_show to remove blank lines
and change the golden output of the tests to not expect the blank lines,
making the tests work with btrfs-progs v6.11 and older versions.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agobtrfs/318: add _require_loop
Mark Harmstone [Thu, 10 Oct 2024 15:36:25 +0000 (16:36 +0100)]
btrfs/318: add _require_loop

btrfs/318 uses loopback devices, but was missing a call to _require_loop
to print the correct message if CONFIG_LOOP is not set.

Signed-off-by: Mark Harmstone <maharmstone@fb.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agocommon/fail_make_request: fix error message
Mark Harmstone [Wed, 31 Jul 2024 11:41:33 +0000 (12:41 +0100)]
common/fail_make_request: fix error message

fail_make_request depends on the kernel option CONFIG_FAIL_MAKE_REQUEST
to function, not CONFIG_FAULT_INJECTION_DEBUG_FS.

Signed-off-by: Mark Harmstone <maharmstone@fb.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agogeneric/694: sync before sampling i_blocks
Christoph Hellwig [Tue, 8 Oct 2024 07:12:09 +0000 (09:12 +0200)]
generic/694: sync before sampling i_blocks

Without a sync there might still be temporary blocks in i_blocks like
indirect block reservations or additional blocks reserved for out of
place writes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agoxfs/157,xfs/547,xfs/548: switch to using _scratch_mkfs_sized
Hans Holmberg [Tue, 8 Oct 2024 10:52:04 +0000 (10:52 +0000)]
xfs/157,xfs/547,xfs/548: switch to using _scratch_mkfs_sized

These test cases specify small -d sizes which combined with a rt dev of
unrestricted size and the rtrmap feature can cause mkfs to fail with
error:

mkfs.xfs: cannot handle expansion of realtime rmap btree; need <x> free
blocks, have <y>

This is due to that the -d size is not big enough to support the
metadata space allocation required for the rt groups.

Switch to use _scratch_mkfs_sized that sets up the -r size parameter
to avoid this. If -r size=x and -d size=x we will not risk running
out of space on the ddev as the metadata size is just a fraction of
the rt data size.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agocommon: make rt_ops local in _try_scratch_mkfs_sized
Hans Holmberg [Tue, 8 Oct 2024 10:52:04 +0000 (10:52 +0000)]
common: make rt_ops local in _try_scratch_mkfs_sized

If we call _try_scratch_mkfs_size with $SCRATCH_RTDEV set followed by
a call with $SCRATCH_RTDEV cleared, rt_ops will have stale size
parameters that will cause mkfs.xfs to fail with:
"size specified for non-existent rt subvolume"

Make rt_ops local to fix this.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agofstests: generic/563: use fs blocksize to do the writes
Qu Wenruo [Sun, 29 Sep 2024 23:50:38 +0000 (09:20 +0930)]
fstests: generic/563: use fs blocksize to do the writes

[FALSE ALERTS]
If the system has a page size larger than 4K, and the fs block size
matches the page size, test case generic/563 will fail:

    --- tests/generic/563.out 2024-04-25 18:13:45.178550333 +0930
    +++ /home/adam/xfstests-dev/results//generic/563.out.bad 2024-09-30 09:09:16.155312379 +0930
    @@ -3,7 +3,8 @@
     read is in range
     write is in range
     write -> read/write
    -read is in range
    +read has value of 8388608
    +read is NOT in range -33792 .. 33792
     write is in range
    ...

Both Ext4 and btrfs fail with 64K block size and 64K page size

[CAUSE]
The test case writes the 8MiB file using the default block size xfs_io
pwrite, which is 4KiB.

Since the fs block size is 64K, such 4KiB write is unaligned inside a
block, causing the fs to read out the full page.

Thus the pwrite will cause the fs to read out every page, resulting the
above 8MiB+ read value.

[FIX]
Fix the test case by using the fs block size to avoid such unaligned
buffered write.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Mark Harmstone <maharmstone@fb.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agosrc/Makefile: install two necessary files
An Long [Thu, 10 Oct 2024 06:23:14 +0000 (14:23 +0800)]
src/Makefile: install two necessary files

parse-dev-tree.awk and parse-extent-tree.awk are used by generic/746.
We need to make sure them are installed, otherwise generic/746 will
have problems if fstests is installed via "make install".

Signed-off-by: An Long <lan@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agosrc/min_dio_alignment: don't return invalid dio_offset_align
Chao Yu [Wed, 11 Sep 2024 03:53:33 +0000 (11:53 +0800)]
src/min_dio_alignment: don't return invalid dio_offset_align

If returned parameters of statx() are: a)STATX_DIOALIGN is set in
stx_mask, b)stx.stx_dio_offset_align is zero, it indicates filesystem
supports DIO, but the file doesn't.

It needs to avoid returning zeroed stx.stx_dio_offset_align value,
instead, we can fallthrough to get alignment size of block device or
page size, otherwise, it may cause potential deadloop, e.g.
generic/465:

align=stx_dio_offset_align(it equals to zero)
page_size=4096
while [ $align -le $page_size ]; do
    echo "$AIO_TEST -a $align -d $testfile.$align" >> $seqres.full
    $AIO_TEST -a $align -d $testfile.$align 2>&1 | tee -a $seqres.full
    align=$((align * 2))
done

Cc: Christoph Hellwig <hch@lst.de>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agoxfs: new EOF fragmentation tests
Dave Chinner [Tue, 24 Sep 2024 08:45:48 +0000 (10:45 +0200)]
xfs: new EOF fragmentation tests

These tests create substantial file fragmentation as a result of
application actions that defeat post-EOF preallocation
optimisations. They are intended to replicate known vectors for
these problems, and provide a check that the fragmentation levels
have been controlled. The mitigations we make may not completely
remove fragmentation (e.g. they may demonstrate speculative delalloc
related extent size growth) so the checks don't assume we'll end up
with perfect layouts and hence check for an exceptable level of
fragmentation rather than none.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
[move to different test number, update to current xfstest APIs]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agobtrfs: test an incremental send scenario with cloning of unaligned extent
Filipe Manana [Fri, 27 Sep 2024 10:28:07 +0000 (11:28 +0100)]
btrfs: test an incremental send scenario with cloning of unaligned extent

Test that doing an incremental send with a file that had its size
decreased and became the destination for a clone operation of an extent
with an unaligned end offset that matches the new file size, works
correctly.

This tests a bug fixed by the following kernel patch:

  "btrfs: send: fix invalid clone operation for file that got its size decreased"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
6 months agofsx: support unshare range fallocate mode
Brian Foster [Thu, 26 Sep 2024 14:41:46 +0000 (10:41 -0400)]
fsx: support unshare range fallocate mode

The fallocate unshare mode flag modifies traditional preallocate
mode to unshare any shared extents backing the target range. Without
the unshare flag, preallocate mode simply assures that blocks are
physically allocated, regardless of whether they might be shared.
Unshare mode behaves the same as preallocate mode outside of the
shared extent case.

Since unshare is fundamentally a modifier to preallocate mode,
enable it via an operation flag. Similar to keep size mode, select
it randomly for fallocate operations and track it via a flag and
string combination for operation logging and replay.

Unshare is mainly used for filesystems that support reflink, but the
operation is equivalent to preallocate mode for non-shared ranges,
so enable it by default. Filesystems that do not support the
fallocate flag (such as those that might not support reflink) will
fail the test operation and disable unshare calls at runtime. Also
provide a new command line option to explicitly disable unshare
calls.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agobtrfs/321: make the test work when compression is enabled
Filipe Manana [Thu, 12 Sep 2024 12:45:00 +0000 (13:45 +0100)]
btrfs/321: make the test work when compression is enabled

When running btrfs/321 with compression enabled it fails like this:

  $ MOUNT_OPTIONS="-o compress" ./check btrfs/321
  FSTYP         -- btrfs
  PLATFORM      -- Linux/x86_64 debian0 6.11.0-rc7-btrfs-next-174+ #1 SMP PREEMPT_DYNAMIC Tue Sep 10 17:11:38 WEST 2024
  MKFS_OPTIONS  -- /dev/sdc
  MOUNT_OPTIONS -- -o compress /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

  btrfs/321 2s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad)
      --- tests/btrfs/321.out 2024-09-12 12:12:11.259272125 +0100
      +++ /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad 2024-09-12 13:18:40.231120012 +0100
      @@ -1,2 +1,5 @@
       QA output created by 321
      -Silence is golden
      +mount: /home/fdmanana/btrfs-tests/scratch_1: can't read superblock on /dev/sdc.
      +       dmesg(1) may have more information after failed mount system call.
      +mount -o compress -o ro /dev/sdc /home/fdmanana/btrfs-tests/scratch_1 failed
      +(see /home/fdmanana/git/hub/xfstests/results//btrfs/321.full for details)
      ...
      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/321.out /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad'  to see the entire diff)

  HINT: You _MAY_ be missing kernel fix:
        10d9d8c3512f btrfs: fix a use-after-free bug when hitting errors inside btrfs_submit_chunk()

  Ran: btrfs/321
  Failures: btrfs/321
  Failed 1 of 1 tests

This is because with compression enabled we get a csum tree that has only
one leaf, and that leaf is the root of the csum tree. That means that
after the test corrupts the leaf, the next mount will fail since an error
loading the root is critical and makes the mount operation fail.

Fix this by creating a file with 128M of data instead of 32M, as this
guarantees that even if compression is enabled, and even with the maximum
allowed leaf size (64K), we still get a csum tree with multiple leaves,
making the test work.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agogeneric: add a regression test for sub-block fsmap queries
Darrick J. Wong [Wed, 18 Sep 2024 20:57:19 +0000 (13:57 -0700)]
generic: add a regression test for sub-block fsmap queries

Zizhi Wo found some bugs in the GETFSMAP implementation if it is fed
sub-fsblock ranges.  Add a regression test for this.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agofstests: fix min_dio_alignment logic for getting device block size
Filipe Manana [Mon, 16 Sep 2024 12:03:12 +0000 (13:03 +0100)]
fstests: fix min_dio_alignment logic for getting device block size

If we failed to get the dio alignment from statx we try to get the
device's block size using the BLKSSZGET ioctl, however we failed to
return it because we don't check if the ioctl succeeded (returned 0).
Furthermore in case the ioctl returned an error, we end up returning an
undefined value since the 'logical_block_size' variable ends up not
being initialized.

This was causing some tests to be skipped on btrfs after commit
ee799a0cf1d4 ("replace _min_dio_alignment with calls to
src/min_dio_alignment"), like generic/240 for example:

  $ ./check generic/240
  FSTYP         -- btrfs
  PLATFORM      -- Linux/x86_64 debian0 6.11.0-rc7-btrfs-next-174+ #1 SMP PREEMPT_DYNAMIC Tue Sep 10 17:11:38 WEST 2024
  MKFS_OPTIONS  -- /dev/sdc
  MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

  generic/240 1s ... [not run] fs block size must be larger than the device block size.  fs block size: 4096, device block size: 4096
  Ran: generic/240
  Not run: generic/240
  Passed all 1 tests

Where before that commit the test ran.

Fix this by checking that the ioctl succeeded.

Fixes: 0e5f196d0a6a ("add a new min_dio_alignment helper")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agofstests: add missing kernel git commit IDs to some tests
Filipe Manana [Thu, 12 Sep 2024 11:26:38 +0000 (12:26 +0100)]
fstests: add missing kernel git commit IDs to some tests

Three tests (btrfs/321, generic/364 and xfs/608) refer to kernel patches
that are now in Linus' git kernel tree, so update the tests to include
the commit IDs.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agooverlay: create a variant to syncfs error test xfs/546
Amir Goldstein [Fri, 30 Aug 2024 18:08:44 +0000 (20:08 +0200)]
overlay: create a variant to syncfs error test xfs/546

Test overlayfs over xfs with and without "volatile" mount option.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
7 months agoext4: Regression test for corruption during on-line resize
Srivathsa Dara [Tue, 17 Sep 2024 13:58:13 +0000 (13:58 +0000)]
ext4: Regression test for corruption during on-line resize

Regression test for:
a6b3bfe176e8 ext4: fix corruption during on-line resize

Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>