]> www.infradead.org Git - users/hch/xfstests-dev.git/log
users/hch/xfstests-dev.git
2 months agofsx: fix compile error for preadv2() xfs-zoned
Shin'ichiro Kawasaki [Tue, 14 Jan 2025 03:48:31 +0000 (12:48 +0900)]
fsx: fix compile error for preadv2()

Commit d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE") introduced
preadv2() calls in ltp/fsx.c. However, sys/uio.h is not included to the
source file, which causes compile errors with the gcc option
-Werror-implicit-function-declaration:

fsx.c: In function 'test_dontcache_io':
fsx.c:1956:15: error: implicit declaration of function 'preadv2'; did you mean 'pread64'? [-Wimplicit-function-declaration]
 1956 |         ret = preadv2(fd, &iov, 1, 0, RWF_DONTCACHE);
      |               ^~~~~~~
      |               pread64
fsx.c: In function 'fsx_rw':
fsx.c:2836:31: error: implicit declaration of function 'pwritev2'; did you mean 'pwrite64'? [-Wimplicit-function-declaration]
 2836 |                         ret = pwritev2(fd, &iov, 1, offset, flags);
      |                               ^~~~~~~~
      |                               pwrite64

To fix it, add the include directive.

Fixes: d6b9d8eff076 ("fsx: add support for RWF_DONTCACHE")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
2 months agoxfs: test that truncate does not spuriously return ENOSPC
Christoph Hellwig [Fri, 29 Nov 2024 05:20:33 +0000 (06:20 +0100)]
xfs: test that truncate does not spuriously return ENOSPC

For zoned file systems, truncate to an offset not aligned to the block
size need to allocate a new block for zeroing the remainder.

Test that this allocation can dip into the reserved pool even when other
threads are waiting for space freed by GC.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test that xfs_repair does not mess up the zone used counter
Christoph Hellwig [Fri, 29 Nov 2024 06:12:09 +0000 (07:12 +0100)]
xfs: test that xfs_repair does not mess up the zone used counter

Check that xfs_repair actually rebuilds the used counter after blowing
away the rmap inode and recreating it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test zoned GC file defragmentation for random writers
Christoph Hellwig [Mon, 25 Nov 2024 05:53:49 +0000 (06:53 +0100)]
xfs: test zoned GC file defragmentation for random writers

Test that zoned GC defragments sequential writers forced into the same
zone.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test zoned GC file defragmentation for sequential writers
Christoph Hellwig [Sun, 24 Nov 2024 07:10:20 +0000 (08:10 +0100)]
xfs: test zoned GC file defragmentation for sequential writers

Test that zoned GC defragments sequential writers forced into the same
zone.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test zoned ENOSPC behavior with multiple writers
Christoph Hellwig [Fri, 22 Nov 2024 17:27:23 +0000 (18:27 +0100)]
xfs: test zoned ENOSPC behavior with multiple writers

Test that multiple parallel writers can't accidentally dip into the reserved
space pool.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test zone stream separation for two buffered writers
Christoph Hellwig [Fri, 22 Nov 2024 17:19:49 +0000 (18:19 +0100)]
xfs: test zone stream separation for two buffered writers

Check that two parallel buffered sequential writers are separated into
different zones when writeback happens before closing the files.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: test zone stream separation for two direct writers
Christoph Hellwig [Fri, 22 Nov 2024 17:03:25 +0000 (18:03 +0100)]
xfs: test zone stream separation for two direct writers

Check that two parallel direct sequential writers are separated into
different zones.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: add a test for writeback after close
Christoph Hellwig [Fri, 22 Nov 2024 09:18:48 +0000 (10:18 +0100)]
xfs: add a test for writeback after close

Test that files written back after closing are packed tightly instead of
using up open zone resources.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: add a test for write lifetime hints
Christoph Hellwig [Fri, 22 Nov 2024 06:47:15 +0000 (07:47 +0100)]
xfs: add a test for write lifetime hints

Test that the zone allocator actually places by temperature bucket.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoadd a new rw_hint helper
Christoph Hellwig [Fri, 22 Nov 2024 07:13:20 +0000 (08:13 +0100)]
add a new rw_hint helper

Add a tool to set the life time hint via fcntl.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: add a test to check that data growfs fails with internal rt device
Christoph Hellwig [Fri, 22 Nov 2024 06:30:14 +0000 (07:30 +0100)]
xfs: add a test to check that data growfs fails with internal rt device

The internal RT device directly follows the data device on the same
block device.  This implies the data device can't be grown, and growfs
should handle this gracefully.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: add test to check for block layer reordering
Christoph Hellwig [Mon, 18 Nov 2024 12:21:07 +0000 (13:21 +0100)]
xfs: add test to check for block layer reordering

Zoned writes using zone append can be easily fragmented when the block
layer or the driver reorders I/O.  Check that a simple sequential
direct write creates a single extent.  This was broken in the kernel
until recently when using the ->commit_rqs interface on devices with
a relatively small max_hw_sectors / max_zone_append_sectors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 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>
2 months agoxfs: add a zoned growfs test
Christoph Hellwig [Tue, 22 Oct 2024 08:58:49 +0000 (10:58 +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>
2 months agoxfs/206: filter out the zoned line from mkfs output
Christoph Hellwig [Mon, 18 Nov 2024 17:07:45 +0000 (18:07 +0100)]
xfs/206: filter out the zoned line from mkfs output

So that the test still passes with a zone enabled mkfs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: skip various tests when using the zoned allocator
Christoph Hellwig [Thu, 30 Jan 2025 05:22:18 +0000 (06:22 +0100)]
xfs: skip various tests when using the zoned allocator

Various file system features tested are incompatible with the zoned
allocator.  Add a _require_xfs_scratch_non_zoned to guard them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: skip various tests on zoned devices
Christoph Hellwig [Thu, 30 Jan 2025 04:44:16 +0000 (05:44 +0100)]
xfs: skip various tests on zoned devices

Various tests don't work with underlying zoned devices because either the
device mapper maps don't align to zone boundaries, or in one case the test
creates an ext2 file system that doesn't support zoned devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: skip filestreams test on internal RT devices
Christoph Hellwig [Tue, 19 Nov 2024 17:24:50 +0000 (18:24 +0100)]
xfs: skip filestreams test on internal RT devices

The filestreams tests using _test_streams force a run on the data
section, but for internal RT zoned devices the data section can be tiny
and might not provide enough space.  Skip these tests as they aren't
really useful when testing a zoned config anyway.

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

internal or external..

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

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: handle zoned file systems in _scratch_xfs_force_no_metadir
Christoph Hellwig [Sun, 24 Nov 2024 13:56:44 +0000 (14:56 +0100)]
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 file systems 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>
2 months agoxfs: add helpers to require zoned/non-zoned file systems
Christoph Hellwig [Thu, 30 Jan 2025 04:44:25 +0000 (05:44 +0100)]
xfs: add helpers to require zoned/non-zoned file systems

Looking at the max_open_zones sysfs attribute to see if a file system is
zoned or not, as various tests depend on that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agocommon: notrun in mkfs_dev for too small zoned file systems
Christoph Hellwig [Wed, 22 Jan 2025 04:48:19 +0000 (05:48 +0100)]
common: notrun in mkfs_dev for too small zoned file systems

Similar to the regular scratch_mkfs, skip the test if the file system
would be so small that there's not enough zones.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 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>
2 months agocommon: support internal RT devices in scratch_mkfs_sized
Christoph Hellwig [Sat, 23 Nov 2024 07:26:24 +0000 (08:26 +0100)]
common: support internal RT devices in scratch_mkfs_sized

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agocommon: support internal RT device in _require_realtime
Christoph Hellwig [Sat, 23 Nov 2024 06:54:15 +0000 (07:54 +0100)]
common: support internal RT device in _require_realtime

If SCRATCH_DEV is a zoned device it implies an internal zoned RT device
and should not be skipped in _require_realtime.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 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>
2 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>
2 months agocommon: skip tests using LVM when the device is no known
Christoph Hellwig [Sun, 19 Jan 2025 05:41:52 +0000 (06:41 +0100)]
common: skip tests using LVM when the device is no known

LVM has a lot of elaborate code to make the users life painful.  This
includes claiming the device type is unknown if it doesn't match it's
elaborately crafted internal list instead of just letting the user use
it.  Skip tests using LVM if this is the case to avoid arcane failures
due to missing lvm devices when using null_blk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agocommon: fix a spelling error in _require_zoned_device
Christoph Hellwig [Tue, 21 Jan 2025 06:47:07 +0000 (07:47 +0100)]
common: fix a spelling error in _require_zoned_device

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs/614: remove the _require_loop call
Christoph Hellwig [Sun, 8 Dec 2024 06:25:54 +0000 (15:25 +0900)]
xfs/614: remove the _require_loop call

This test only creates file system images as regular files, but never
actually uses the kernel loop driver.  Remove the extra requirement.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs/614: query correct direct I/O alignment
Christoph Hellwig [Sun, 8 Dec 2024 06:23:45 +0000 (15:23 +0900)]
xfs/614: query correct direct I/O alignment

When creating XFS file systems on files, mkfs will query the file system
for the minimum alignment, which can be larger than that of the
underlying device.  Do the same to link the right output file.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs/541: _notrun if the file system can't mount
Christoph Hellwig [Mon, 27 Jan 2025 08:24:51 +0000 (09:24 +0100)]
xfs/541: _notrun if the file system can't mount

A file system created without an RT section might not be able to mount
with an rtdev specified if the RT device has a larger LBA size.

Instead of letting the test fail, _notrun it for that case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs/540: use _scratch_mkfs_xfs
Christoph Hellwig [Wed, 22 Jan 2025 04:37:57 +0000 (05:37 +0100)]
xfs/540: use _scratch_mkfs_xfs

So that the test is _notrun instead of failed for conflicting options.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs/419: use _scratch_mkfs_xfs
Christoph Hellwig [Wed, 22 Jan 2025 04:37:36 +0000 (05:37 +0100)]
xfs/419: use _scratch_mkfs_xfs

So that the test is _notrun instead of failed for conflicting options.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 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>
2 months agogeneric/418: use min_dio_alignment
Christoph Hellwig [Mon, 27 Jan 2025 08:34:26 +0000 (09:34 +0100)]
generic/418: use min_dio_alignment

Otherwise this test uses the wrong sector size on the RT device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2 months agoxfs: remove the post-EOF prealloc tests from the auto and quick groups
Christoph Hellwig [Thu, 30 Jan 2025 04:44:00 +0000 (05:44 +0100)]
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>
2 months agoTEMP: disable direct I/O in _create_loop_device
Christoph Hellwig [Mon, 27 Jan 2025 08:09:34 +0000 (09:09 +0100)]
TEMP: disable direct I/O in _create_loop_device

The loop driver picks the block device based on sb->s_bdev, which
is incorrect for XFS file systems with a RT device.  Until this is
fixed in the loop driver, disable direct I/O support entirely.

Signed-off-by: Christoph Hellwig <hch@lst.de>
3 months agocommon/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section
Darrick J. Wong [Thu, 21 Nov 2024 00:27:33 +0000 (16:27 -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>
3 months agogeneric/331,xfs/240: support files that skip delayed allocation
Darrick J. Wong [Thu, 21 Nov 2024 00:27:33 +0000 (16:27 -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 when the rt extent size > 1 fsblock (or on
any file with extent size hints), 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>
3 months agoxfs: remove xfs/131 now that we allow reflink on realtime volumes
Darrick J. Wong [Thu, 21 Nov 2024 00:27:33 +0000 (16:27 -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>
3 months agoxfs: race fsstress with realtime refcount btree scrub and repair
Darrick J. Wong [Thu, 21 Nov 2024 00:27:32 +0000 (16:27 -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>
3 months agoxfs/27[24]: adapt for checking files on the realtime volume
Darrick J. Wong [Thu, 21 Nov 2024 00:27:32 +0000 (16:27 -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>
3 months agoxfs: create fuzz tests for the realtime refcount btree
Darrick J. Wong [Thu, 21 Nov 2024 00:27:32 +0000 (16:27 -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>
3 months agocommon/populate: create realtime refcount btree
Darrick J. Wong [Thu, 21 Nov 2024 00:27:32 +0000 (16:27 -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>
3 months agofuzzy: create missing fuzz tests for rt rmap btrees
Darrick J. Wong [Thu, 21 Nov 2024 00:27:31 +0000 (16:27 -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>
3 months agopopulate: check that we created a realtime rmap btree of the given height
Darrick J. Wong [Thu, 21 Nov 2024 00:27:31 +0000 (16:27 -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>
3 months agopopulate: adjust rtrmap calculations for rtgroups
Darrick J. Wong [Thu, 21 Nov 2024 00:27:31 +0000 (16:27 -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>
3 months agoxfs/443: use file allocation unit, not dbsize
Darrick J. Wong [Thu, 21 Nov 2024 00:27:30 +0000 (16:27 -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>
3 months agoxfs: skip tests if formatting small filesystem fails
Darrick J. Wong [Thu, 21 Nov 2024 00:27:30 +0000 (16:27 -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>
3 months agoxfs/3{43,32}: adapt tests for rt extent size greater than 1
Darrick J. Wong [Thu, 21 Nov 2024 00:27:30 +0000 (16:27 -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>
3 months agoxfs/341: update test for rtgroup-based rmap
Darrick J. Wong [Thu, 21 Nov 2024 00:27:30 +0000 (16:27 -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>
3 months agoxfs: fix various problems with fsmap detecting the data device
Darrick J. Wong [Thu, 21 Nov 2024 00:27:30 +0000 (16:27 -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 filesystems
write a superblock header at the start of the rt device, so update these
tests.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs: race fsstress with realtime rmap btree scrub and repair
Darrick J. Wong [Thu, 21 Nov 2024 00:27:29 +0000 (16:27 -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>
3 months agofuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file
Darrick J. Wong [Thu, 21 Nov 2024 00:27:29 +0000 (16:27 -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>
3 months agoxfs/336: port to common/metadump
Darrick J. Wong [Sun, 5 Jan 2025 21:50:14 +0000 (13:50 -0800)]
xfs/336: port to common/metadump

xfs/336 does this somewhat sketchy thing where it mdrestores into a
regular file, and then does this to validate the restored metadata:

SCRATCH_DEV=$TEST_DIR/image _scratch_mount

Unfortunately, commit 1a49022fab9b4d causes the following regression:

 --- /tmp/fstests/tests/xfs/336.out      2024-11-12 16:17:36.733447713 -0800
 +++ /var/tmp/fstests/xfs/336.out.bad    2025-01-04 19:10:39.861871114 -0800
 @@ -5,4 +5,5 @@ Create big file
  Explode the rtrmapbt
  Create metadump file
  Restore metadump
 -Check restored fs
 +Usage: _set_fs_sysfs_attr <mounted_device> <attr> <content>
 +(see /var/tmp/fstests/xfs/336.full for details)

This is due to the fact that SCRATCH_DEV is temporarily reassigned to
the regular file.  That path is passed straight through _scratch_mount
to _xfs_prepare_for_eio_shutdown, but that helper _fails because the
"dev" argument isn't actually a path to a block device.

Fix this by porting it to the new common/metadump code that we merged
last year.

Cc: <fstests@vger.kernel.org> # v2024.12.08
Fixes: 1a49022fab9b4d ("fstests: always use fail-at-unmount semantics for XFS")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs: fix tests that try to access the realtime rmap inode
Darrick J. Wong [Thu, 21 Nov 2024 00:27:29 +0000 (16:27 -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>
3 months agocommon: test statfs reporting with project quota
Darrick J. Wong [Tue, 17 Dec 2024 18:32:00 +0000 (10:32 -0800)]
common: test statfs reporting with project quota

Create a test to check that statfs on a directory tree with a project
quota will report the quota limit and available blocks; and that the
available blocks reported doesn't exceed that of the whole filesystem.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs: regression testing of quota on the realtime device
Darrick J. Wong [Thu, 21 Nov 2024 00:27:28 +0000 (16:27 -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>
3 months agoxfs: fix quota tests to adapt to realtime quota
Darrick J. Wong [Thu, 21 Nov 2024 00:27:28 +0000 (16:27 -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>
3 months agocommon: enable testing of realtime quota when supported
Darrick J. Wong [Thu, 21 Nov 2024 00:27:28 +0000 (16:27 -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>
3 months agoxfs: fix tests for persistent qflags
Darrick J. Wong [Thu, 21 Nov 2024 00:27:28 +0000 (16:27 -0800)]
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>
3 months agoxfs: fix quota detection in fuzz tests
Darrick J. Wong [Wed, 27 Nov 2024 21:01:15 +0000 (13:01 -0800)]
xfs: fix quota detection in fuzz tests

With metadir, quota options persist until they are changed by mount
options.  Therefore, we can set the quota flags in MKFS_OPTIONS and
needn't supply them in MOUNT_OPTIONS.  Unfortunately, this means that we
cannot grep the MOUNT_OPTIONS anymore; we must mount the fs and run
src/feature to determine if quotas are enabled.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs: test persistent quota flags
Darrick J. Wong [Thu, 21 Nov 2024 00:27:27 +0000 (16:27 -0800)]
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>
3 months agoxfs: update tests for quota files in the metadir
Darrick J. Wong [Thu, 21 Nov 2024 00:27:27 +0000 (16:27 -0800)]
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>
3 months agoxfs: fix fuzz tests of rtgroups bitmap and summary files
Darrick J. Wong [Thu, 21 Nov 2024 00:27:27 +0000 (16:27 -0800)]
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>
3 months agocommon/fuzzy: adapt the scrub stress tests to support rtgroups
Darrick J. Wong [Thu, 21 Nov 2024 00:27:27 +0000 (16:27 -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>
3 months agocommon/xfs: capture realtime devices during metadump/mdrestore
Darrick J. Wong [Thu, 21 Nov 2024 00:27:26 +0000 (16:27 -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>
3 months agoxfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands
Darrick J. Wong [Thu, 21 Nov 2024 00:27:26 +0000 (16:27 -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>
3 months agoxfs/449: update test to know about xfs_db -R
Darrick J. Wong [Thu, 21 Nov 2024 00:27:26 +0000 (16:27 -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>
3 months agoxfs/185: update for rtgroups
Darrick J. Wong [Thu, 21 Nov 2024 00:27:25 +0000 (16:27 -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>
3 months agocommon: pass the realtime device to xfs_db when possible
Darrick J. Wong [Thu, 21 Nov 2024 00:27:25 +0000 (16:27 -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>
3 months agoxfs/206: update mkfs filtering for rt groups feature
Darrick J. Wong [Thu, 21 Nov 2024 00:27:25 +0000 (16:27 -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>
3 months agopunch-alternating: detect xfs realtime files with large allocation units
Darrick J. Wong [Thu, 21 Nov 2024 00:27:25 +0000 (16:27 -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>
3 months agocommon/populate: use metadump v2 format by default for fs metadata snapshots
Darrick J. Wong [Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -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>
3 months agocommon/ext4: reformat external logs during mdrestore operations
Darrick J. Wong [Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -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>
3 months agofuzzy: stress data and rt sections of xfs filesystems equally
Darrick J. Wong [Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -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>
3 months agocommon/{fuzzy,populate}: use _scratch_xfs_mdrestore
Darrick J. Wong [Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -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>
3 months agocommon/populate: refactor caching of metadumps to a helper
Darrick J. Wong [Thu, 21 Nov 2024 00:27:24 +0000 (16:27 -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>
3 months agofstests: test mkfs.xfs protofiles with xattr support
Darrick J. Wong [Thu, 21 Nov 2024 00:27:23 +0000 (16:27 -0800)]
fstests: test mkfs.xfs protofiles with xattr support

Make sure we can do protofiles with xattr support.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs: test metapath repairs
Darrick J. Wong [Thu, 21 Nov 2024 00:27:23 +0000 (16:27 -0800)]
xfs: test metapath repairs

Functional testing for metadir path checking and repairs.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoscrub: race metapath online fsck with fsstress
Darrick J. Wong [Thu, 21 Nov 2024 00:27:23 +0000 (16:27 -0800)]
scrub: race metapath online fsck with fsstress

Add a pair of new tests to exercise fsstress vs. metapath repairs.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs/122: disable this test for any codebase that knows about metadir
Darrick J. Wong [Fri, 22 Nov 2024 21:18:18 +0000 (13:18 -0800)]
xfs/122: disable this test for any codebase that knows about metadir

All of the ondisk structure size checks from this test were copied to
the build time checks in xfs_ondisk.h.  This means that the kernel and
xfsprogs build processes check the structure sizes, which means that
fstests no longer needs to do that.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs/163: bigger fs for metadir
Darrick J. Wong [Thu, 21 Nov 2024 00:27:23 +0000 (16:27 -0800)]
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>
3 months agoxfs: create fuzz tests for metadata directories
Darrick J. Wong [Thu, 21 Nov 2024 00:27:23 +0000 (16:27 -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>
3 months agoxfs/509: adjust inumbers accounting for metadata directories
Darrick J. Wong [Thu, 21 Nov 2024 00:27:22 +0000 (16:27 -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>
3 months agoxfs/{050,144,153,299,330}: update quota reports to handle metadir trees
Darrick J. Wong [Thu, 21 Nov 2024 00:27:22 +0000 (16:27 -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>
3 months agoxfs/206: update for metadata directory support
Darrick J. Wong [Thu, 21 Nov 2024 00:27:22 +0000 (16:27 -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>
3 months agocommon/repair: patch up repair sb inode value complaints
Darrick J. Wong [Thu, 21 Nov 2024 00:27:21 +0000 (16:27 -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>
3 months agoxfs/{030,033,178}: forcibly disable metadata directory trees
Darrick J. Wong [Thu, 21 Nov 2024 00:27:21 +0000 (16:27 -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>
3 months agovarious: fix finding metadata inode numbers when metadir is enabled
Darrick J. Wong [Thu, 21 Nov 2024 00:27:21 +0000 (16:27 -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>
3 months agoxfs/349: reclassify this test as not dangerous
Darrick J. Wong [Thu, 16 Jan 2025 20:18:05 +0000 (12:18 -0800)]
xfs/349: reclassify this test as not dangerous

This test creates a filesystem with all known types of metadata.  It
doesn't fuzz anything, nor does it actually repair anything.  Hence we
can put it in the auto group and drop the dangerous tags.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agoxfs/28[56]: add to the auto group
Darrick J. Wong [Thu, 23 Jan 2025 17:00:02 +0000 (09:00 -0800)]
xfs/28[56]: add to the auto group

Enable /some/ testing of online fsck for everybody by adding these two
stress tests to the autogroup.  At this time I don't have any plans to
do the same for the other scrub stress tests.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agomisc: remove the dangerous_scrub group
Darrick J. Wong [Thu, 16 Jan 2025 19:44:03 +0000 (11:44 -0800)]
misc: remove the dangerous_scrub group

Now that online fsck has been in the upstream kernel for 8 months, I
think it's stabilized enough that the scrub functionality tests don't
need to hide behind the "dangerous" label anymore.  Move them all to the
scrub group and delete the dangerous_scrub group.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agomisc: add xfs_scrub + xfs_repair fuzz tests to the scrub and repair groups
Darrick J. Wong [Thu, 16 Jan 2025 20:02:09 +0000 (12:02 -0800)]
misc: add xfs_scrub + xfs_repair fuzz tests to the scrub and repair groups

All the tests in the "fuzzers_bothrepair" group test xfs_scrub +
xfs_repair, so they all should be in the 'scrub' and 'repair' groups.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agomisc: fix misclassification of verifier fuzz tests
Darrick J. Wong [Thu, 16 Jan 2025 20:05:54 +0000 (12:05 -0800)]
misc: fix misclassification of verifier fuzz tests

All the tests in the "fuzzers_norepair" group do not test xfs_scrub.
Therefore, we should remove them all from 'dangerous_scrub' group.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agomisc: fix misclassification of xfs_scrub + xfs_repair fuzz tests
Darrick J. Wong [Thu, 16 Jan 2025 20:03:52 +0000 (12:03 -0800)]
misc: fix misclassification of xfs_scrub + xfs_repair fuzz tests

All the tests in the "fuzzers_bothrepair" group actually test xfs_scrub
and xfs_repair.  Therefore, we should put them in the 'repair' group.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
3 months agomisc: fix misclassification of xfs_repair fuzz tests
Darrick J. Wong [Thu, 16 Jan 2025 20:02:09 +0000 (12:02 -0800)]
misc: fix misclassification of xfs_repair fuzz tests

All the tests in the "fuzzers_repair" group actually test xfs_repair,
not scrub.  Therefore, we should remove them all from 'dangerous_scrub'
and put them in the 'repair' group.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>