]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/log
xfstests-dev.git
2 years agofstests: add missing require of xfs_io fiemap command to some tests
Filipe Manana [Fri, 7 Oct 2022 13:53:35 +0000 (14:53 +0100)]
fstests: add missing require of xfs_io fiemap command to some tests

btrfs/257, btrfs/258, btrfs/259 and xfs/443 use the fiemap command of
xfs_io but don't do a '_require_xfs_io_command "fiemap"'. So add the
missing requirement.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon/populate: fix _xfs_metadump usage in _scratch_populate_cached v2022.10.09
Darrick J. Wong [Wed, 5 Oct 2022 22:31:06 +0000 (15:31 -0700)]
common/populate: fix _xfs_metadump usage in _scratch_populate_cached

_xfs_metadump requires that the caller pass in "none" for the log device
if it doesn't have a log device, so fix this call site.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon/populate: don't metadump xfs filesystems twice
Darrick J. Wong [Wed, 5 Oct 2022 22:31:01 +0000 (15:31 -0700)]
common/populate: don't metadump xfs filesystems twice

Due to some braino on my part, _scratch_populate_cached will metadump
the filesystem twice -- once with compression disabled, and again with
it enabled, maybe.  Get rid of the first metadump.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/128: try to force file allocation behavior
Darrick J. Wong [Wed, 5 Oct 2022 22:30:55 +0000 (15:30 -0700)]
xfs/128: try to force file allocation behavior

Over the years, I've noticed that this test occasionally fails when I've
programmed the allocator to hand out the minimum amount of space with
each allocation or if extent size hints are enabled:

  --- /tmp/fstests/tests/xfs/128.out      2022-09-01 15:09:11.506679341 -0700
  +++ /var/tmp/fstests/xfs/128.out.bad    2022-10-04 17:32:50.992000000 -0700
  @@ -20,7 +21,9 @@
   56ed2f712c91e035adeeb26ed105a982  SCRATCH_MNT/test-128/file3
   b81534f439aac5c34ce3ed60a03eba70  SCRATCH_MNT/test-128/file4
   Check files
   free blocks after creating some reflink copies is in range
   free blocks after CoW some reflink copies is in range
  -free blocks after defragging all reflink copies is in range
  -free blocks after all tests is in range
  +free blocks after defragging all reflink copies has value of 8620027
  +free blocks after defragging all reflink copies is NOT in range 8651819 .. 8652139
  +free blocks after all tests has value of 8620027
  +free blocks after all tests is NOT in range 8651867 .. 8652187

It turns out that under the right circumstances, the _pwrite_byte at the
start of this test will end up allocating two extents to file1.  This
almost never happens when delalloc is enabled or when the extent size is
large, and is more prone to happening if the extent size is > 1FSB but
small, the allocator hands out small allocations, or if writeback shoots
down pages in random order.

When file1 gets more than 1 extent, problems start to happen.  The free
space accounting checks at the end of the test assume that file1 and
file4 still share the same space at the end of the test.  This
definitely happens if file1 gets one extent (since fsr ignores
single-extent files), but if there's more than 1, fsr will try to
defragment it.  If fsr succeeds in copying the file contents to a temp
file with fewer extents than the source file, it will switch the
contents, but unsharing the contents in the process.  This cause the
free space to be lower than expected, and the test fails.

Resolve this situation by preallocating space beforehand to try to set
up file1 with a single space extent.  If the test fails and we got more
than one extent, note that in the output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/229: do not _xfs_force_bdev on TEST_DIR
Darrick J. Wong [Wed, 5 Oct 2022 22:30:49 +0000 (15:30 -0700)]
xfs/229: do not _xfs_force_bdev on TEST_DIR

In commit ea15099b71, I observed that this test tries to test the
behavior of the extent size hint on the data device.  If the test runner
set up MKFS_OPTIONS such that the filesystem gets created with a
realtime section and rtinherit set on the root directory, then the
preconditions of this test (creating files on the data section) is not
satisfied and the results of this test are incorrect.  The solution was
to force all files created by this test to be assigned to the data
section.

Unfortunately, the correction that I made has side effects beyond this
test -- by clearing rtinherit on $TEST_DIR, all tests that run after
this one will create files on the data section, because the test
filesystem persists for the duration of the entire test run.  This leads
to the wrong things being tested.

Fix this new problem by clearing the rtinherit flag on $TDIR, which
contains the files created by this test and is removed during cleanup,
and leave a few comments celebrating our new discoveries.

Fixes: ea15099b71 ("xfs: force file creation to the data device for certain layout tests")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agoxfs/114: fix missing reflink requires
Darrick J. Wong [Wed, 5 Oct 2022 22:30:44 +0000 (15:30 -0700)]
xfs/114: fix missing reflink requires

This test both requires cp --reflink and the scratch filesystem to
support reflink.  Add the missing _requires calls.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/092: skip test if file allocation unit isn't aligned
Darrick J. Wong [Wed, 5 Oct 2022 22:30:38 +0000 (15:30 -0700)]
generic/092: skip test if file allocation unit isn't aligned

This test exercises allocation behavior when truncating a preallocated
file down to 5M and then up to 7M.  If those two sizes aren't aligned
with the file allocation unit length, then the FIEMAP output will show
blocks beyond EOF.  That will cause trouble with the golden output, so
skip this test if that will be the case.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test fiemap on large file with extents shared through a snapshot
Filipe Manana [Fri, 7 Oct 2022 13:53:34 +0000 (14:53 +0100)]
btrfs: test fiemap on large file with extents shared through a snapshot

Verify that fiemap correctly reports the sharedness of extents for a file
with a very large number of extents, spanning many b+tree leaves in the fs
tree, and when the file's subvolume was snapshoted.

Currently this passes on all kernel releases and its purpose is to prevent
and detect regressions in the future, as this actually happened during
recent development on the btrfs' fiemap related code. With this test we
now have better coverage for fiemap when a file is shared through a
snapshot.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agobtrfs: test active zone tracking
Naohiro Aota [Wed, 5 Oct 2022 05:46:44 +0000 (14:46 +0900)]
btrfs: test active zone tracking

A ZNS device limits the number of active zones, which is the number of
zones can be written at the same time. To deal with the limit, btrfs's
zoned mode tracks which zone (corresponds to a block group on the SINGLE
profile) is active, and finish a zone if necessary.

This test checks if the active zone tracking and the finishing of zones
works properly. First, it fills <number of max active zones> zones
mostly. And, run some data/metadata stress workload to force btrfs to use a
new zone.

This test fails on an older kernel (e.g, 5.18.2) like below.

btrfs/273
[failed, exit status 1]- output mismatch (see /host/btrfs/273.out.bad)
    --- tests/btrfs/273.out     2022-09-15 07:52:18.000000000 +0000
    +++ /host/btrfs/273.out.bad 2022-09-15 07:59:14.290967793 +0000
    @@ -1,2 +1,5 @@
     QA output created by 273
    -Silence is golden
    +stress_data_bgs failed
    +stress_data_bgs_2 failed
    +failed: '/bin/btrfs subvolume snapshot /mnt/scratch /mnt/scratch/snap825'
    +(see /host/btrfs/273.full for details)
    ...
    (Run 'diff -u /var/lib/xfstests/tests/btrfs/273.out /host/btrfs/273.out.bad'  to see the entire diff)

The failure is fixed with a series "btrfs: zoned: fix active zone tracking
issues" [1] (upstream commits from 65ea1b66482f ("block: add bdev_max_segments()
helper") to 2ce543f47843 ("btrfs: zoned: wait until zone is finished when
allocation didn't progress")).

[1] https://lore.kernel.org/linux-btrfs/cover.1657321126.git.naohiro.aota@wdc.com/

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocommon: introduce zone_capacity() to return a zone capacity
Naohiro Aota [Wed, 5 Oct 2022 05:46:43 +0000 (14:46 +0900)]
common: introduce zone_capacity() to return a zone capacity

Introduce _zone_capacity() to return a zone capacity of the given address
in the given device (optional). Move _filter_blkzone_report() for it, and
rewrite btrfs/237 with it.

Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agogeneric/299: skip test early if falloc is not supported
Pavel Reichl [Thu, 22 Sep 2022 18:55:02 +0000 (20:55 +0200)]
generic/299: skip test early if falloc is not supported

Move the _require_xfs_io_command "falloc" above the
potencially 'expensive' function _get_max_file_size

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
2 years agocleanup: remove left files after test finishes
Pavel Reichl [Thu, 22 Sep 2022 18:55:01 +0000 (20:55 +0200)]
cleanup: remove left files after test finishes

Fix file leak in _get_max_file_size - This is obviously mostly
problematic for FS lacking support for sparse files.

There seems to be some seek_sanity_testfile files that are not
cleaned up and take up space:

-rwxr-xr-x. 1 root root 8.0G Sep 22 13:39 seek_sanity_testfile10

g/394: Clean up test files taking space:

-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899
-rwxr-xr-x. 1 root root 1.0G Sep 22 14:58 394.1183899-1
-rwxr-xr-x. 1 root root    0 sep 22 14:58 394.1183899+1

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>