]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/log
xfstests-dev.git
3 months agofstests: add a new rw_hint helper
Christoph Hellwig [Thu, 8 May 2025 05:34:31 +0000 (07:34 +0200)]
fstests: 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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon: generalize _filter_agno
Christoph Hellwig [Thu, 8 May 2025 05:34:30 +0000 (07:34 +0200)]
common: generalize _filter_agno

Rename and move to common/xfs so that it can be reused for rgnos in new
zoned tests.

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>
3 months agoxfs/349: don't run on kernels that don't support scrub
Darrick J. Wong [Wed, 7 May 2025 21:54:23 +0000 (14:54 -0700)]
xfs/349: don't run on kernels that don't support scrub

Don't run this scrub test if the kernel doesn't support scrub.

Fixes: f5f0c11a67a8f5 ("xfs: fuzz every field of every structure")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agofsstress: fix attr_set naming
Darrick J. Wong [Wed, 7 May 2025 21:54:07 +0000 (14:54 -0700)]
fsstress: fix attr_set naming

Back in 2020 I converted attr_set to lsetxattr, but neglected to notice
that the attr name now has to have the prefix "user." which attr_set
used to append for us.  Unfortunately nobody runs fsstress in verbose
mode so I didn't notice until now, and even then only because fuse2fs
stupidly accepts any name, even if that corrupts the filesystem.

Found by running generic/642 on fuse2fs.

Cc: fstests@vger.kernel.org # v2022.05.01
Fixes: 808f39a416c962 ("fsstress: stop using attr_set")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon: support internal RT devices in scratch_mkfs_sized
Christoph Hellwig [Thu, 1 May 2025 13:38:58 +0000 (08:38 -0500)]
common: support internal RT devices in scratch_mkfs_sized

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon: support internal RT device in _require_realtime
Christoph Hellwig [Thu, 1 May 2025 13:38:57 +0000 (08:38 -0500)]
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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon: notrun in mkfs_dev for too small zoned file systems
Christoph Hellwig [Thu, 1 May 2025 13:38:56 +0000 (08:38 -0500)]
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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoxfs: check for zoned-specific errors in _try_scratch_mkfs_xfs
Christoph Hellwig [Thu, 1 May 2025 13:38:55 +0000 (08:38 -0500)]
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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agofstests/MAINTAINERS: update ocfs2 mailing list address
Anthony Iliopoulos [Wed, 30 Apr 2025 12:23:42 +0000 (14:23 +0200)]
fstests/MAINTAINERS: update ocfs2 mailing list address

Bring the ocfs2 mailing list address up to date, following the upstream
change in kernel commit a57b4b7f0557 ("MAINTAINERS: update ocfs2-devel
mailing list address").

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocheck: Replace exit with _fatal and _exit in check
Nirjhar Roy (IBM) [Wed, 30 Apr 2025 12:45:23 +0000 (12:45 +0000)]
check: Replace exit with _fatal and _exit in check

Some of the "status=<val>;exit" and "exit <val>" were not
replaced with _exit <val> and _fatal. Doing it now.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon: Move exit related functions to a common/exit
Nirjhar Roy (IBM) [Wed, 30 Apr 2025 12:45:22 +0000 (12:45 +0000)]
common: Move exit related functions to a common/exit

Introduce a new file common/exit that will contain all the exit
related functions. This will remove the dependencies these functions
have on other non-related helper files and they can be indepedently
sourced. This was suggested by Dave Chinner[1].
While moving the exit related functions, remove _die() and die_now()
and replace die_now with _fatal(). It is of no use to keep the
unnecessary wrappers.

[1] https://lore.kernel.org/linux-xfs/Z_UJ7XcpmtkPRhTr@dread.disaster.area/

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agofstests: common/btrfs: add _ prefix to temp fsid helper functions v2025.04.27
Anand Jain [Thu, 17 Apr 2025 12:27:22 +0000 (20:27 +0800)]
fstests: common/btrfs: add _ prefix to temp fsid helper functions

Just adding a _ prefix to the two temp fsid helper functions and
a rename in common/btrfs to keep the coding style consistent.

Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
3 months agofstests: btrfs/315: fix golden output mismatch caused by newer util-linux
Qu Wenruo [Thu, 24 Apr 2025 07:29:07 +0000 (16:59 +0930)]
fstests: btrfs/315: fix golden output mismatch caused by newer util-linux

[BUG]
With util-linux v2.41.0 and newer, test case btrfs/315 will fail like
the following:

btrfs/315 1s ... - output mismatch (see /home/adam/xfstests-dev/results//btrfs/315.out.bad)
    --- tests/btrfs/315.out 2025-04-24 15:31:28.684112371 +0930
    +++ /home/adam/xfstests-dev/results//btrfs/315.out.bad 2025-04-24 15:31:31.854883557 +0930
    @@ -1,7 +1,7 @@
     QA output created by 315
     ---- seed_device_must_fail ----
     mount: SCRATCH_MNT: WARNING: source write-protected, mounted read-only.
    -mount: TEST_DIR/315/tempfsid_mnt:  system call failed: File exists.
    +mount: TEST_DIR/315/tempfsid_mnt: () failed: File exists.
     ---- device_add_must_fail ----
     wrote 9000/9000 bytes at offset 0

[CAUSE]

With util-linux v2.41.0, the mount failure error message changed to the following:

  mount: /mnt/test/315/tempfsid_mnt: fsconfig() failed: File exists.

Thus the existing filter only striped the "fsconfig" part, leaving the
"()" without changing it to " system call".

[FIX]
The test case is doomed in day one by using a local filter, which
requires stupid catch-up game against util-linux.

Meanwhile we already have a much better filter, _filter_error_mount().
That helper can already handle the newer v2.41 output.

Let's use the superior common filter and update the golden output to:

  mount: File exists.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ fixed: filter.btrfs is not needed ]

3 months agofstests: btrfs/253: fix false alert due to _set_fs_sysfs_attr changes
Qu Wenruo [Mon, 21 Apr 2025 07:59:40 +0000 (17:29 +0930)]
fstests: btrfs/253: fix false alert due to _set_fs_sysfs_attr changes

[FALSE FAILURE]
Test btrfs/253 now fails like the following:

btrfs/253 2s ... - output mismatch (see ~/xfstests/results//btrfs/253.out.bad)
    --- tests/btrfs/253.out 2022-05-11 11:25:30.753333331 +0930
    +++ ~/xfstests/results//btrfs/253.out.bad 2025-04-20 17:28:39.139180394 +0930
    @@ -5,6 +5,7 @@
     Calculate request size so last memory allocation cannot be completely fullfilled.
     Third allocation.
     Force allocation of system block type must fail.
    +./common/rc: line 5213: echo: write error: No space left on device
     Verify first allocation.
     Verify second allocation.
     Verify third allocation.
    ...
    (Run 'diff -u ~/xfstests/tests/btrfs/253.out ~/xfstests/results//btrfs/253.out.bad'  to see the entire diff)

[CAUSE]
Since commit 0a9011ae6a36 ("fstests: common/rc: set_fs_sysfs_attr:
redirect errors to stdout") the function _set_fs_sysfs_attr() always
output everything into stdout, thus the stderr redirection makes no
sense anymore.

And the expected failure will cause output difference and fail the test.

[FIX]
Use the helper _set_sysfs_policy_must_fail() instead, which will handle
the failure.
And update the golden output to include the expected ENOSPC error
message.

Fixes: 0a9011ae6a36 ("fstests: common/rc: set_fs_sysfs_attr: redirect errors to stdout")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
3 months agofstests: btrfs/271: specify "-m raid1" to avoid false alerts
Qu Wenruo [Thu, 17 Apr 2025 10:26:23 +0000 (19:56 +0930)]
fstests: btrfs/271: specify "-m raid1" to avoid false alerts

[FALSE FAILURE]
Test case btrfs/271 will fail like the following, if the MKFS_OPTIONS
has specified a metadata profile (either SINGLE or DUP):

  btrfs/271 1s ... - output mismatch (see /home/adam/xfstests/results//btrfs/271.out.bad)
      --- tests/btrfs/271.out 2022-11-07 09:59:11.256666666 +1030
      +++ /home/adam/xfstests/results//btrfs/271.out.bad 2025-04-17 19:49:00.129443427 +0930
      @@ -1,523 +1,9 @@
       QA output created by 271
       Allow global fail_make_request feature
       Step 1: writing with one failing mirror:
      -wrote 8192/8192 bytes at offset 0
      -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
      +fsync: Input/output error
       Step 2: verify that the data reads back fine:
      ...
      (Run 'diff -u /home/adam/xfstests/tests/btrfs/271.out /home/adam/xfstests/results//btrfs/271.out.bad'  to see the entire diff)
  Ran: btrfs/271
  Failures: btrfs/271
  Failed 1 of 1 tests

[CAUSE]
The test case relies on mkfs.btrfs to use RAID1 as default metadata
profile if multiple devices are provided.

This is no longer true if the run has specified certain profile in
MKFS_OPTIONS.

If "-m dup" or "-m single" is specified, the fs will flip read-only as
either profile can handle any missing or failed device super block
writeback.

[FIX]
Just specify both metadata (RAID1) and data (RAID1, already in the test
case) to avoid the false failure.

Reported-by: kdevops <kdevops@lists.linux.dev>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
3 months agof2fs/011: test to check out-of-space issue
Chao Yu [Thu, 27 Mar 2025 05:50:51 +0000 (13:50 +0800)]
f2fs/011: test to check out-of-space issue

This is a regression testcase to check whether we will handle
out-of-space case correctly during fallocate() on pinned file
once we disable checkpoint.

Testcase:
1. mount f2fs w/ checkpoint=disable option
2. create fragmented file data
3. set flag w/ pinned flag
4. fallocate space for pinned file, expects panic due to running
out of space.

We should apply both commit ("f2fs: fix to avoid panic once
fallocation fails for pinfile") and commit ("f2fs: fix to avoid
running out of free segments") to avoid system panic.
Note that w/ these two commit, we fixed such issue in both
convential and zoned block device.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agogeneric/233: use relative path to invoke fsstress
Christoph Hellwig [Wed, 16 Apr 2025 04:51:12 +0000 (06:51 +0200)]
generic/233: use relative path to invoke fsstress

This test uses su to run fsstress as $qa_user.  Because the shell calling
fsstress is run as $qa_user it might not be able to access the xfstests
or parent directory which might only be accessible to the user xfstests
is run as (e.g. root).  Switch back to calling fsstress using a relative
path, partially reverting the effects of commit c475ff6ff6d7
("common/config: add $here to FSSTRESS_PROG").

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agogeneric/231: use relative path to invoke fsx
Christoph Hellwig [Wed, 16 Apr 2025 04:51:11 +0000 (06:51 +0200)]
generic/231: use relative path to invoke fsx

This test uses su to run fsx as $qa_user.  Because the shell calling
fsx is run as $qa_user it might not be able to access the xfstests or
parent directory which might only be accessible to the user xfstests
is run as (e.g. root).  Switch back to calling fsx using a relative
path, partially reverting commit 1c67e8b191fe
("config: add FSX_PROG variable").

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agogeneric/033: Don't call 'fzero' with the KEEP_SIZE flag
Anna Schumaker [Fri, 25 Apr 2025 15:24:52 +0000 (11:24 -0400)]
generic/033: Don't call 'fzero' with the KEEP_SIZE flag

None of the fzero calls in this test end up writing past the end of the
file, so this flag is unnecessary and can cause the test to fail on
filesystems that don't implement FALLOC_FL_KEEP_SIZE.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoREADME: add supported fs list
Zorro Lang [Fri, 28 Mar 2025 16:46:09 +0000 (00:46 +0800)]
README: add supported fs list

To clarify the supported filesystems by fstests, add a fs list to
README file.

Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: btrfs: testcase for sysfs chunk_size attribute validation v2025.04.13
Anand Jain [Wed, 5 Feb 2025 10:04:37 +0000 (18:04 +0800)]
fstests: btrfs: testcase for sysfs chunk_size attribute validation

Checks if the sysfs attribute sanitizes arguments and verifies
input syntax allocation/data/chunk_size.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: btrfs: testcase for sysfs policy syntax verification
Anand Jain [Wed, 29 Jan 2025 07:56:56 +0000 (15:56 +0800)]
fstests: btrfs: testcase for sysfs policy syntax verification

Checks if the sysfs attribute sanitizes arguments and verifies
input syntax.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: common/sysfs: add new file sysfs and helpers
Anand Jain [Fri, 31 Jan 2025 07:14:43 +0000 (15:14 +0800)]
fstests: common/sysfs: add new file sysfs and helpers

Introduce `verify_sysfs_syntax()` and `_require_fs_sysfs_attr_policy()`
to verify whether a sysfs attribute rejects invalid input arguments
during writes.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: filter: helper for sysfs error filtering
Anand Jain [Wed, 29 Jan 2025 07:56:29 +0000 (15:56 +0800)]
fstests: filter: helper for sysfs error filtering

Added filter helper to filter sysfs write errors, retain only the
error part.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: common/rc: set_fs_sysfs_attr: redirect errors to stdout
Anand Jain [Wed, 29 Jan 2025 07:54:50 +0000 (15:54 +0800)]
fstests: common/rc: set_fs_sysfs_attr: redirect errors to stdout

Redirect sysfs write errors to stdout as a preparatory patch to enable
testing of expected sysfs write failures. Also, log the executed
sysfs write command and its failure if any to seqres.full for better
debugging and traceability.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon: exit --> _exit
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:52 +0000 (07:00 +0000)]
common: exit --> _exit

Replace exit <return-val> with _exit <return-val> which
is introduced in the previous patch.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/config: Introduce _exit wrapper around exit command
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:51 +0000 (07:00 +0000)]
common/config: Introduce _exit wrapper around exit command

We should always set the value of status correctly when we are exiting.
Else, "$?" might not give us the correct value.
If we see the following trap
handler registration in the check script:

if $OPTIONS_HAVE_SECTIONS; then
     trap "_kill_seq; _summary; exit \$status" 0 1 2 3 15
else
     trap "_kill_seq; _wrapup; exit \$status" 0 1 2 3 15
fi

So, "exit 1" will exit the check script without setting the correct
return value. I ran with the following local.config file:

[xfs_4k_valid]
FSTYP=xfs
TEST_DEV=/dev/loop0
TEST_DIR=/mnt1/test
SCRATCH_DEV=/dev/loop1
SCRATCH_MNT=/mnt1/scratch

[xfs_4k_invalid]
FSTYP=xfs
TEST_DEV=/dev/loop0
TEST_DIR=/mnt1/invalid_dir
SCRATCH_DEV=/dev/loop1
SCRATCH_MNT=/mnt1/scratch

This caused the init_rc() to catch the case of invalid _test_mount
options. Although the check script correctly failed during the execution
of the "xfs_4k_invalid" section, the return value was 0, i.e "echo $?"
returned 0. This is because init_rc exits with "exit 1" without
correctly setting the value of "status". IMO, the correct behavior
should have been that "$?" should have been non-zero.

The next patch will replace exit with _exit.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocheck,common{rc,preamble}: Decouple init_rc() call from sourcing common/rc
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:50 +0000 (07:00 +0000)]
check,common{rc,preamble}: Decouple init_rc() call from sourcing common/rc

Silently executing scripts during sourcing common/rc isn't good practice
and also causes unnecessary script execution. Decouple init_rc() call
and call init_rc() explicitly where required.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocheck: Remove redundant _test_mount in check
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:49 +0000 (07:00 +0000)]
check: Remove redundant _test_mount in check

init_rc already does a _test_mount. Hence removing the additional
_test_mount call when OLD_TEST_FS_MOUNT_OPTS != TEST_FS_MOUNT_OPTS.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/367: Remove redundant sourcing of common/config
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:48 +0000 (07:00 +0000)]
generic/367: Remove redundant sourcing of common/config

common/config will be source by _begin_fstest

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/749: Remove redundant sourcing of common/rc
Nirjhar Roy (IBM) [Wed, 9 Apr 2025 07:00:47 +0000 (07:00 +0000)]
generic/749: Remove redundant sourcing of common/rc

common/rc is already sourced before the test starts running
in _begin_fstest() preamble.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric: add a test for atomic writes
Catherine Hoang [Thu, 10 Apr 2025 04:23:17 +0000 (21:23 -0700)]
generic: add a test for atomic writes

Add a test to validate the new atomic writes feature.

Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/275: fix on 32k fsblock filesystems
Darrick J. Wong [Wed, 9 Apr 2025 15:16:12 +0000 (08:16 -0700)]
generic/275: fix on 32k fsblock filesystems

This test fails on 32k-fsblock filesystems:

dd: failed to open '/opt/tmp3': No space left on device
dd: failed to open '/opt/tmp4': No space left on device
Pre rm space:
Filesystem     Type 1024-blocks    Used Available Capacity Mounted on
/dev/sda4      xfs      2031616 2030624       992     100% /opt
Post rm space:
Filesystem     Type 1024-blocks    Used Available Capacity Mounted on
/dev/sda4      xfs      2031616 2030368      1248     100% /opt
could not sufficiently fill filesystem

On a 32k-fsblock filesystem, creating tmp3 and tmp4 requires more than
1MB for the transaction allocation, which is why this test fails to fill
the filesystem.  To fix this, touch the four tmp files before trying to
use up all the free space.  The fix in ef25a29fa49a50 was incomplete.

Cc: fstests@vger.kernel.org # v2022.07.24
Fixes: ef25a29fa49a50 ("generic/275: fix premature enospc errors when fs block size is large")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/792: skip test if rextsize isn't congruent with operation length
Darrick J. Wong [Wed, 9 Apr 2025 15:15:34 +0000 (08:15 -0700)]
xfs/792: skip test if rextsize isn't congruent with operation length

This test writes 64k chunks and encodes the file content hash in the
golden output.  Don't run it if the file allocation unit isn't congruent
with 64k.  Fixes extsize=28k configurations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/801: provide missing sysfs-dump function
Darrick J. Wong [Tue, 8 Apr 2025 18:17:32 +0000 (11:17 -0700)]
xfs/801: provide missing sysfs-dump function

This test uses sysfs-dump to capture THP diagnostic information to
$seqres.full.  Unfortunately, that's not a standard program (it's one of
my many tools) and I forgot to paste the script into the test.  Hence
it's been broken since merge for everyone else.  Fix it.

Cc: fstests@vger.kernel.org # v2024.08.11
Fixes: 518896a7b483c0 ("xfs: test online repair when xfiles consists of THPs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/rc: fix dumping of corrupt ext* filesystems
Darrick J. Wong [Mon, 7 Apr 2025 23:59:31 +0000 (16:59 -0700)]
common/rc: fix dumping of corrupt ext* filesystems

The parameters to _ext4_metadump are device, dumpfile, and compress
options.  This callsite got the arguments in the wrong order, which
causes fstests to compress all of /dev/sdX as /dev/sdX.zst which is not
what we want.

Cc: fstests@vger.kernel.org # v2022.05.01
Fixes: 9fb30a9500c169 ("common: capture qcow2 dumps of corrupt ext* filesystems")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: remove the post-EOF prealloc tests from the auto and quick groups
Christoph Hellwig [Tue, 8 Apr 2025 06:51:55 +0000 (08:51 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/750 : add missing _fixed_by_git_commit line to the test
Swarna Prabhu [Tue, 1 Apr 2025 02:29:21 +0000 (02:29 +0000)]
generic/750 : add missing _fixed_by_git_commit line to the test

Testing generic/750 with older kernels indicated that more work has to
be done, since we were able to reproduce a hang with v6.10-rc7 with 2.5
hours soak duration. We tried to reproduce the same issue on v6.12 and could
no longer reproduce the original hang. This motivated us to identify the commit
2e6506e1c4ee ("mm/migrate: fix deadlock in migrate_pages_batch() on large folios")
that fixes the originally reported deadlock hang annotated as pending work
to evaluate on generic/750. Hence if you are using kernel older than v6.11-rc4
this commit is needed.

Below is the kernel trace collected on v6.10-rc7 without the above
commit and CONFGI_PROVE_LOCKING enabled:

[ 8942.920967]  ret_from_fork_asm+0x1a/0x30
[ 8942.921450]  </TASK>
[ 8942.921711] INFO: task 750:2532 blocked for more than 241 seconds.                                                                                         [ 8942.922413]       Not tainted 6.10.0-rc7 #9
[ 8942.922894] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.                                                                      [ 8942.923770] task:750             state:D stack:0     pid:2532  tgid:2532  ppid:2349   flags:0x00004002                                                     [ 8942.924820] Call Trace:
[ 8942.925109]  <TASK>
[ 8942.925362]  __schedule+0x465/0xe10
[ 8942.925756]  schedule+0x39/0x140
[ 8942.926114]  io_schedule+0x42/0x70
[ 8942.926493]  folio_wait_bit_common+0x10e/0x330
[ 8942.926986]  ? __pfx_wake_page_function+0x10/0x10
[ 8942.927506]  migrate_pages_batch+0x765/0xeb0
[ 8942.927986]  ? __pfx_compaction_alloc+0x10/0x10
[ 8942.928488]  ? __pfx_compaction_free+0x10/0x10
[ 8942.928983]  migrate_pages+0xbfd/0xf50
[ 8942.929377]  ? __pfx_compaction_alloc+0x10/0x10
[ 8942.929838]  ? __pfx_compaction_free+0x10/0x10
[ 8942.930553]  compact_zone+0xa4d/0x11d0
[ 8942.930936]  ? rcu_is_watching+0xd/0x40
[ 8942.931332]  compact_node+0xa9/0x120
[ 8942.931704]  sysctl_compaction_handler+0x71/0xd0
[ 8942.932177]  proc_sys_call_handler+0x1b8/0x2d0
[ 8942.932641]  vfs_write+0x281/0x530
[ 8942.932993]  ksys_write+0x67/0xf0
[ 8942.933381]  do_syscall_64+0x69/0x140
[ 8942.933822]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ 8942.934415] RIP: 0033:0x7f8a460215c7
[ 8942.934843] RSP: 002b:00007fff75cf7bb0 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 8942.935720] RAX: ffffffffffffffda RBX: 00007f8a45f8f740 RCX: 00007f8a460215c7
[ 8942.936550] RDX: 0000000000000002 RSI: 000055e89e3a7790 RDI: 0000000000000001
[ 8942.937405] RBP: 000055e89e3a7790 R08: 0000000000000000 R09: 0000000000000000                                                                              [ 8942.938236] R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000002
[ 8942.939068] R13: 00007f8a4617a5c0 R14: 00007f8a46177e80 R15: 0000000000000000
[ 8942.939902]  </TASK>
[ 8942.940169] Future hung task reports are suppressed, see sysctl kernel.hung_task_warnings
[ 8942.941150] INFO: lockdep is turned off.

With the commit cherry picked to v6.10-rc7 , the test passes
successfully without any hang/deadlock, however
with CONFIG_PROVE_LOCKING enabled we do see the below trace for the
passing case:

 BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!
 turning off the locking correctness validator.
 CPU: 1 PID: 2959 Comm: kworker/u34:5 Not tainted 6.10.0-rc7+ #12
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 2024.11-5 01/28/2025
 Workqueue: btrfs-endio-write btrfs_work_helper [btrfs]
 Call Trace:
  <TASK>
  dump_stack_lvl+0x68/0x90
  __lock_acquire.cold+0x186/0x1b1
  lock_acquire+0xd6/0x2e0
  ? btrfs_get_alloc_profile+0x27/0x90 [btrfs]
  seqcount_lockdep_reader_access+0x70/0x90 [btrfs]
  ? btrfs_get_alloc_profile+0x27/0x90 [btrfs]
  btrfs_get_alloc_profile+0x27/0x90 [btrfs]
  btrfs_reserve_extent+0xa9/0x290 [btrfs]
  btrfs_alloc_tree_block+0xa5/0x520 [btrfs]
  ? lockdep_unlock+0x5e/0xd0
  ? __lock_acquire+0xc6f/0x1fa0
  btrfs_force_cow_block+0x111/0x5f0 [btrfs]
  btrfs_cow_block+0xcc/0x2d0 [btrfs]
  btrfs_search_slot+0x502/0xd00 [btrfs]
  ? stack_depot_save_flags+0x24/0x8a0
  btrfs_lookup_file_extent+0x48/0x70 [btrfs]
  btrfs_drop_extents+0x108/0xce0 [btrfs]
  ? _raw_spin_unlock_irqrestore+0x35/0x60
  ? __create_object+0x5e/0x90
  ? rcu_is_watching+0xd/0x40
  ? kmem_cache_alloc_noprof+0x280/0x320
  insert_reserved_file_extent+0xea/0x3a0 [btrfs]
  ? btrfs_init_block_rsv+0x51/0x60 [btrfs]
  btrfs_finish_one_ordered+0x3ea/0x840 [btrfs]
  btrfs_work_helper+0x103/0x4b0 [btrfs]
  ? lock_release+0x177/0x2e0
  process_one_work+0x21a/0x590
  ? lock_is_held_type+0xd5/0x130
  worker_thread+0x1bf/0x3c0
  ? __pfx_worker_thread+0x10/0x10
  kthread+0xdd/0x110
  ? __pfx_kthread+0x10/0x10
  ret_from_fork+0x2d/0x50
  ? __pfx_kthread+0x10/0x10
  ret_from_fork_asm+0x1a/0x30
  </TASK>
 Started fstests-check.scope - [systemd-run] /usr/bin/bash -c "exit 77".
 fstests-check.scope: Deactivated successfully.

Signed-off-by: Swarna Prabhu <s.prabhu@samsung.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/539: Ignore remount failures on v5 xfs
Nirjhar Roy (IBM) [Tue, 4 Mar 2025 13:48:16 +0000 (13:48 +0000)]
xfs/539: Ignore remount failures on v5 xfs

Remount with noattr2 fails on a v5 filesystem, however the deprecation
warnings still get printed and that is exactly what the test
is checking. So ignore the mount failures in this case.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/235: add to the auto group v2025.03.30
Christoph Hellwig [Mon, 17 Mar 2025 05:51:38 +0000 (06:51 +0100)]
xfs/235: add to the auto group

xfs/235 is the only test effectively exercising the temporary enabling
of SB_ACTIVE during log recovery.  Add it to the auto group to increase
coverage.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: test for CONFIG_QFMT_V2 in _require_quota
Eric Sandeen [Fri, 14 Mar 2025 15:44:16 +0000 (10:44 -0500)]
fstests: test for CONFIG_QFMT_V2 in _require_quota

When CONFIG_QUOTA is enabled but CONFIG_QFMT_V2 is disabled in the
kernel config, many quota tests on ext4 will fail in odd ways,
when in fact they should be _notrun. Add a CONFIG_QFMT_V2 test to
_require_quota() to catch this for filesystems that require it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: btrfs: zoned: verify RAID conversion with write pointer mismatch
Johannes Thumshirn [Wed, 19 Mar 2025 11:09:47 +0000 (12:09 +0100)]
fstests: btrfs: zoned: verify RAID conversion with write pointer mismatch

Recently we had a bug report about a kernel crash that happened when the
user was converting a filesystem to use RAID1 for metadata, but for some
reason the device's write pointers got out of sync.

Test this scenario by manually injecting de-synchronized write pointer
positions and then running conversion to a metadata RAID1 filesystem.

In the testcase also repair the broken filesystem and check if both system
and metadata block groups are back to the default 'DUP' profile
afterwards.

Link: https://lore.kernel.org/linux-btrfs/CAB_b4sBhDe3tscz=duVyhc9hNE+gu=B8CrgLO152uMyanR8BEA@mail.gmail.com/
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
4 months agobtrfs/058: fix test to actually have an open tmpfile during the send operation
Filipe Manana [Wed, 19 Mar 2025 12:13:28 +0000 (12:13 +0000)]
btrfs/058: fix test to actually have an open tmpfile during the send operation

The test's goal is to exercise a send operation while there's a tmpfile in
the snapshot, but that doesn't happen since the background xfs_io process
that created the tmpfile ends up exiting before we create the snapshot, so
the snapshot nevers gets a tmpfile.

Fix this by using a different approach, with a fifo and tailing it to the
stdin of a background xfs_io process and then writing to the fifo to
create the tmpfile. This keeps the xfs_io process running with the tmpfile
open while we snapshot and run the send operation.

While at it also add code to verify we have the tmpfile (an orphan inode
item) in the snapshot's tree.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
4 months agogeneric: test fsync of file with no more hard links
Filipe Manana [Tue, 25 Mar 2025 12:24:40 +0000 (12:24 +0000)]
generic: test fsync of file with no more hard links

Test that if we fsync a file that has no more hard links, power fail and
then mount the filesystem, after the journal/log is replayed, the file
doesn't exists anymore.

This exercises a bug recently found and fixed by the following patch for
the linux kernel:

   btrfs: fix fsync of files with no hard links not persisting deletion

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/206: filter out the zoned line from mkfs output
Christoph Hellwig [Fri, 21 Mar 2025 07:21:42 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/049: skip on zoned devices
Christoph Hellwig [Fri, 21 Mar 2025 07:21:41 +0000 (08:21 +0100)]
xfs/049: skip on zoned devices

This tes creates an ext2 file system, which doesn't support zoned
devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: skip various tests when using the zoned allocator
Christoph Hellwig [Fri, 21 Mar 2025 07:21:40 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: skip filestreams tests on internal RT devices
Christoph Hellwig [Fri, 21 Mar 2025 07:21:39 +0000 (08:21 +0100)]
xfs: skip filestreams tests 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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: xfs_copy doesn't like RT sections
Christoph Hellwig [Fri, 21 Mar 2025 07:21:38 +0000 (08:21 +0100)]
xfs: xfs_copy doesn't like RT sections

internal or external..

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: no quota support with internal rtdev
Christoph Hellwig [Fri, 21 Mar 2025 07:21:37 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: handle zoned file systems in _scratch_xfs_force_no_metadir
Christoph Hellwig [Fri, 21 Mar 2025 07:21:36 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: add helpers to require zoned/non-zoned file systems
Christoph Hellwig [Fri, 21 Mar 2025 07:21:35 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon: allow _require_non_zoned_device without an argument
Christoph Hellwig [Fri, 21 Mar 2025 07:21:34 +0000 (08:21 +0100)]
common: allow _require_non_zoned_device without an argument

So that callers can pass $SCRATCH_RTDEV directly without needing to check
that it actually is set.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon: extend the zoned device checks in _require_dm_target
Christoph Hellwig [Fri, 21 Mar 2025 07:21:33 +0000 (08:21 +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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/540: use _scratch_mkfs_xfs
Christoph Hellwig [Fri, 21 Mar 2025 07:21:32 +0000 (08:21 +0100)]
xfs/540: use _scratch_mkfs_xfs

So that the test is _notrun instead of failed for conflicting options
like -r zoned or specific RT group configurations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/419: use _scratch_mkfs_xfs
Christoph Hellwig [Fri, 21 Mar 2025 07:21:31 +0000 (08:21 +0100)]
xfs/419: use _scratch_mkfs_xfs

So that the test is _notrun instead of failed for conflicting options
like -r zoned or specific RT group configurations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/177: force a small file system size
Christoph Hellwig [Fri, 21 Mar 2025 07:21:30 +0000 (08:21 +0100)]
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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/818: fix some design issues
Darrick J. Wong [Fri, 21 Mar 2025 21:28:26 +0000 (14:28 -0700)]
xfs/818: fix some design issues

While QA'ing zoned filesystem support, I discovered some design errors
in this test:

1) Since we're test formatting a sparse file on an xfs filesystem,
there's no need to play games with optimal device size; we can create
a totally sparse file that's the same size as SCRATCH_DEV.

2) mkfs.xfs cannot create realtime files, so if it fails with that,
there's no need to continue the test.

3) If mkfs -p fails for none of the proscribed reasons, it should exit
the test.  The final cat $tmp.mkfs will take care of tweaking the golden
output to register the test failure for further investigation.

Cc: fstests@vger.kernel.org # v2025.03.09
Fixes: 6d39dc34e61e11 ("xfs: test filesystem creation with xfs_protofile")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/populate: drop fallocate mode 0 requirement
Darrick J. Wong [Fri, 21 Mar 2025 21:28:10 +0000 (14:28 -0700)]
common/populate: drop fallocate mode 0 requirement

None of the _scratch_$FSTYP_populate functions use fallocate mode 0 (aka
preallocation) to run, so drop the _require check.  This enables xfs/349
and friends to work on always-cow xfs filesystems.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/537: disable quota mount options for pre-metadir rt filesystems
Darrick J. Wong [Fri, 21 Mar 2025 21:27:54 +0000 (14:27 -0700)]
generic/537: disable quota mount options for pre-metadir rt filesystems

Fix this regression in generic/537:

mount: /opt: permission denied.
       dmesg(1) may have more information after failed mount system call.
mount -o uquota,gquota,pquota, -o ro,norecovery -ortdev=/dev/sdb4 /dev/sda4 /opt failed
mount -o uquota,gquota,pquota, -o ro,norecovery -ortdev=/dev/sdb4 /dev/sda4 /opt failed
(see /var/tmp/fstests/generic/537.full for details)

for reasons explained in the giant comment.  TLDR: quota and rt aren't
compatible on older xfs filesystems so we have to work around that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/614: determine the sector size of the fs image by doing a test format
Darrick J. Wong [Fri, 21 Mar 2025 21:27:38 +0000 (14:27 -0700)]
xfs/614: determine the sector size of the fs image by doing a test format

In some cases (such as xfs always_cow=1), the configuration of the test
filesystem determines the sector size of the filesystem that we're going
to simulate formatting.  Concretely, even if TEST_DEV is a block device
with 512b sectors, the directio geometry can specify 4k writes to avoid
nasty RMW cycles.  When this happens, mkfs.xfs will set the sector size
to that 4k accordingly, but the golden output selection is wrong.  Fix
this.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/45[34]: add colored emoji variants to unicode tests
Darrick J. Wong [Fri, 21 Mar 2025 21:27:23 +0000 (14:27 -0700)]
generic/45[34]: add colored emoji variants to unicode tests

Ted told me this morning about a recent problem with kernel Unicode name
casefolding vs. emoji -- initially, someone decided that zero-width
joiners should be stripped out of filenames during comparisons, which
lead to malicious git pulls of branches containing "<zwj>.git/config"
files overwriting git repo config files.  A quick fix was to stop
ignoring the "ignorable" code points, but that broke emoji in filenames,
because emoji use zero-width joiners to combine simpler emoji into more
complex ones, or alter skin tones, or colors, etc.  Reportedly the
casefolding code will also fold a red heart into a black one.

So.  To our filename support test, let's add various colors of heart
emoji and various skin tones of heart-hands; and compound emoji
consisting of multiple emoji glued together with zero width joiners.
This actually caused a buffer overflow in the string-escaping functions
of xfs_scrub phase 5 because I hadn't anticipated that we'd end up with
a filename consisting *entirely* of nonprinting bytes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: test filesystem recovery with rdump
Darrick J. Wong [Fri, 21 Mar 2025 21:27:07 +0000 (14:27 -0700)]
xfs: test filesystem recovery with rdump

Test how well we can dump a fully populated filesystem's contents.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agof2fs: test dirty status handling on database file
Chao Yu [Tue, 25 Mar 2025 08:34:28 +0000 (16:34 +0800)]
f2fs: test dirty status handling on database file

This is a regression testcase to check whether we will handle database
inode dirty status correctly:
1. create a regular file, and write data into the file
2. start transaction on the file (via F2FS_IOC_START_ATOMIC_WRITE)
3. write transaction data to the file
4. rename the file
5. commit and end the transaction (via F2FS_IOC_COMMIT_ATOMIC_WRITE)
6. drop caches in order to call f2fs_evict_inode()
It expects kernel panic will gone after we apply commit 03511e936916
("f2fs: fix inconsistent dirty state of atomic file").

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Daeho Jeong <daehojeong@google.com>
Cc: Jianan Huang <huangjianan@xiaomi.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agof2fs: new test to detect and repair nlink corruption
Chao Yu [Tue, 25 Mar 2025 12:58:24 +0000 (20:58 +0800)]
f2fs: new test to detect and repair nlink corruption

This is a regression test to check whether fsck can handle corrupted
nlinks correctly, it uses inject.f2fs to inject nlinks w/ wrong value,
and expects fsck.f2fs can detect such corruption and do the repair.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/rc: introduce _check_f2fs_filesystem()
Chao Yu [Tue, 25 Mar 2025 12:58:23 +0000 (20:58 +0800)]
common/rc: introduce _check_f2fs_filesystem()

_check_generic_filesystem() will fail the test once it detects
corruption, let's introduce _check_f2fs_filesystem() to just check
filesystem w/ --dry-run option, and return the error number, then
let caller to decide whether the corruption is as expected or not.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/rc: use -f for mkfs.f2fs by default
Chao Yu [Tue, 25 Mar 2025 12:58:22 +0000 (20:58 +0800)]
common/rc: use -f for mkfs.f2fs by default

Otherwise, mkfs will fail due to there is an existing filesystem
in the image.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/config: export F2FS_FSCK_PROG
Chao Yu [Tue, 25 Mar 2025 12:58:21 +0000 (20:58 +0800)]
common/config: export F2FS_FSCK_PROG

Let's export F2FS_FSCK_PROG, then we can use it in
_check_f2fs_filesystem() later.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/config: export F2FS_INJECT_PROG
Chao Yu [Tue, 25 Mar 2025 12:58:20 +0000 (20:58 +0800)]
common/config: export F2FS_INJECT_PROG

export F2FS_INJECT_PROG w/ inject.f2fs, it can be used for fault injection.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/config: remove redundant export variables
Chao Yu [Tue, 25 Mar 2025 12:58:19 +0000 (20:58 +0800)]
common/config: remove redundant export variables

F2FS_IO_PROG and TIMEOUT_PROG are exported twice, remove the redudant
one.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: remove run_setsid test way from check
Zorro Lang [Thu, 20 Mar 2025 19:28:12 +0000 (03:28 +0800)]
fstests: remove run_setsid test way from check

This patch partially revert most of the 88d60f434 ("common: fix pkill
by running test program in a separate session"), it does:
1. Remove run_setsid script
2. Remove all run_setsid related things from check
3. Keep the change in _scratch_xfs_stress_scrub_cleanup() which is a
   bug fix for xfs_scrub test.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: remove privatens test way from check
Zorro Lang [Thu, 20 Mar 2025 19:28:11 +0000 (03:28 +0800)]
fstests: remove privatens test way from check

This patch totally revert:
  ce7f796ad check: remove the deprecation of sessionid
  336784e3d check: disable HAVE_PRIVATENS by default
  949bdf8ea check: deprecate using process sessions to isolate test instances
and partially revert:
  247ab01fa check: run tests in a private pid/mount namespace

So it does:
1. Remove "run_privatens" related things from xfstests/check, due to
   check doesn't need that test way.
2. Keep run_privatens script and related changes for check-parallel.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon/rc: explicitly test for engine availability in _require_fio v2025.03.17
Eric Sandeen [Fri, 14 Mar 2025 18:37:45 +0000 (13:37 -0500)]
common/rc: explicitly test for engine availability in _require_fio

The current test in _require_fio (--warnings-fatal --showcmd) does not
fail if an invalid/unavailable io engine is specified.

Add an explicit test that every requested io engine in the job file
is actually available.

Also, remove the "ioe_e4defrag" entries in the [global] stanza of several
ext4 tests which use fio jobfiles. While ioengines can be set in the
[global] section, they can also be overridden in individual, subsequent
stanzas. In each affected test (ext4/301, ext4/302, ext4/303, and
ext4/304) every individual stanza after [global]re-specifies an ioengine;
either with ioengine=e4defrag or ioengine=libaio.

Because of this re-specification, the ioengine in the [global] section
is ignored. This is a good thing, because ioe_e4defrag is not a valid
ioengine, and would fail this new hand-rolled check, even though fio
did not complain.

So rather than over-complicate this new check, simply remove the unused,
invalid "ioengine=ioe_e4defrag" lines in these tests.

Signed-off-by: Eric Sandeen <sandeen@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>
5 months agolib: make a few symbols static
Eric Sandeen [Mon, 10 Mar 2025 18:29:08 +0000 (13:29 -0500)]
lib: make a few symbols static

There are a few symbols in lib/tlibio.c which should be static,
and sparse notices this so fix it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agolib: replace aiocb_t with struct aiocb
Eric Sandeen [Mon, 10 Mar 2025 18:29:07 +0000 (13:29 -0500)]
lib: replace aiocb_t with struct aiocb

aiocb_t isn't defined anywhere, use struct aiocb instead,
to make sparse happy.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agolib: fix empty arg function prototypes
Eric Sandeen [Mon, 10 Mar 2025 18:29:06 +0000 (13:29 -0500)]
lib: fix empty arg function prototypes

Several function prototypes used () when in fact they take
arguments. Fix those to make sparse happy.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agolib: Fix non-ANSI function declarations
Eric Sandeen [Mon, 10 Mar 2025 18:29:05 +0000 (13:29 -0500)]
lib: Fix non-ANSI function declarations

lib/ was full of non-ANSI function declarations, fix them to make
sparse happier.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agotreewide: check for #ifdef __linux__ not linux
Eric Sandeen [Tue, 11 Mar 2025 13:46:48 +0000 (08:46 -0500)]
treewide: check for #ifdef __linux__ not linux

There are several #ifdef linux guards in the code, which caused
a few sparse warnings, because while gcc defines both linux
and __linux__, sparse defines only __linux__. So, switch our
guards to check for __linux__ which is defined by both gcc
and sparse.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: enable sparse checking with make C=[12]
Eric Sandeen [Mon, 10 Mar 2025 18:29:03 +0000 (13:29 -0500)]
fstests: enable sparse checking with make C=[12]

Enable "make C=1" sparse checking when files get rebuilt. To check
all files, run "make clean" first.

Enable "make C=2" sparse checking of all files without rebuilding them.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon/rc: use getent when available
Eric Sandeen [Mon, 10 Mar 2025 17:55:51 +0000 (12:55 -0500)]
common/rc: use getent when available

Zorro noticed that on systems using nss-altfiles, some tests failed when
trying to parse /etc/passwd directly. The "getent" command does the
right thing in this case, so let's use it as long as it's available.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agogeneric: add missed _require_idmapped_mounts check
Anthony Iliopoulos [Tue, 4 Mar 2025 23:48:19 +0000 (00:48 +0100)]
generic: add missed _require_idmapped_mounts check

Skip the test on older kernels that don't implement mount_setattr and
open_tree syscalls, instead of failing.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agosrc/locktest: add missing struct cast with syscall getsockname()
Luis Henriques [Tue, 4 Mar 2025 12:21:19 +0000 (12:21 +0000)]
src/locktest: add missing struct cast with syscall getsockname()

The usage of variable 'myAddr' (struct sockaddr_in) is being casted into a
'struct sockaddr' when used with bind() and with connect().  This patch
adds that cast when used with getsockname() as well, otherwise we'll get the
following error:

locktest.c: In function 'main':
locktest.c:1155:39: error: passing argument 2 of 'getsockname' from incompatible pointer type [-Wincompatible-pointer-types]
 1155 |                 if (getsockname(s_fd, &myAddr, &addr_len)) {
      |                                       ^~~~~~~
      |                                       |
      |                                       struct sockaddr_in *
In file included from /usr/include/fortify/sys/socket.h:23,
                 from locktest.c:19:
/usr/include/sys/socket.h:391:23: note: expected 'struct sockaddr * restrict' but argument is of type 'struct sockaddr_in *'
  391 | int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
      |                       ^

Signed-off-by: Luis Henriques <luis@igalia.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove old tools from tools directory
Dave Chinner [Thu, 6 Mar 2025 21:34:50 +0000 (08:34 +1100)]
fstests: remove old tools from tools directory

ag-wipe, db-walk, fs-walk and interop are all old 2000s era SGI QA
scripts that are either not usable anymore of have been superceded
by much more recent functionality.

interop only runs on machines with the host named "bruce" or
"whack", requires NFS mounts from a machine named "snort" and access
to a specific user's home dir. I know what all these were; they were
test and build machines in SGI's engineering office in Melbourne,
Australia. That went away in ~2009....

ag-wipe is unused and has been superceded by multiple different sets of
functionality (e.g. ./check --large-fs).

db-walk is unused by fstests and now is native xfs_db functionality.

fs-walk is dumping the md5sum and stat info of every file in a
directory heirachy and only used by the interop script....

Remove them all.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove tools/auto-qa
Dave Chinner [Thu, 6 Mar 2025 21:34:49 +0000 (08:34 +1100)]
fstests: remove tools/auto-qa

This is a 2000s era SGI test script that no-one uses anymore. It
likely doesn't even work because it is dependent on CVS and/or
the SGI proprietary ptools revision control system for source
control. Hence it clearly hasn't been used for years, so remove it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove crash script
Dave Chinner [Thu, 6 Mar 2025 21:34:48 +0000 (08:34 +1100)]
fstests: remove crash script

This is an old, early 2000s SGI era script for crash and recovery
testing XFS filesystems. We have much better ways of doing this
today with tools like dm-error, dm-flakey, etc. Nobody has been
using this script for years, so remove it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove old soak script
Dave Chinner [Thu, 6 Mar 2025 21:34:47 +0000 (08:34 +1100)]
fstests: remove old soak script

There is an old script for soak testing using check in the source
tree called "soak". All it does is run fsstress in a loop on the
scratch device, but to do that it needs to include the entire
fstests config/setup scripts.

These days we have much better soak testing capabilities (e.g. the
soak and stress groups, with controllable iterations, durations,
load, etc) so there's no point in keeping old scripts like this
around that add weird dependencies to the core infrastructure.

Remove it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove setup script
Dave Chinner [Thu, 6 Mar 2025 21:34:46 +0000 (08:34 +1100)]
fstests: remove setup script

THere is a script that will echo the current setup of the fstests
directory. This is largely the same output as running 'check -n' to
do a dry-run outputs. Hence this script is redundant, not likely to
be widely used and is easily replaced with check itself. Remove it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocheck: remove the deprecation of sessionid v2025.03.09
Zorro Lang [Thu, 6 Mar 2025 09:49:24 +0000 (17:49 +0800)]
check: remove the deprecation of sessionid

As "privatens" way isn't recommended temporarily, it can't replace
"sessionid" way for now. So remove the deprecation.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocheck: disable HAVE_PRIVATENS by default
Zorro Lang [Thu, 6 Mar 2025 09:49:23 +0000 (17:49 +0800)]
check: disable HAVE_PRIVATENS by default

Currently we have 3 ways to run a test case in _run_seq():

  if [ -n "${HAVE_PRIVATENS}" ]; then
      ./tools/run_privatens "./$seq"
      ...
  elif [ -n "${HAVE_SYSTEMD_SCOPES}" ]; then
      systemd-run --quiet --unit "${unit}" --scope \
             ./tools/run_setsid "./$seq" &
      ...
  else
      ./tools/run_setsid "./$seq" &
      ...
  fi

The "privatens" way brings in some regressions. We need more time
to develop and test this way, it's not time let it to be the
first default choice, so isolate the HAVE_PRIVATENS initialization
by a TRY_PRIVATENS parameter, and disable it by default.

Set TRY_PRIVATENS=yes to give "privatens" a try, otherwise run in
old ways. This patch can be removed after "privatens" way is stable.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section
Darrick J. Wong [Thu, 20 Feb 2025 21:47:15 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agogeneric/331,xfs/240: support files that skip delayed allocation
Darrick J. Wong [Thu, 20 Feb 2025 21:47:15 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agoxfs: remove xfs/131 now that we allow reflink on realtime volumes
Darrick J. Wong [Thu, 20 Feb 2025 21:47:14 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agoxfs: race fsstress with realtime refcount btree scrub and repair
Darrick J. Wong [Thu, 20 Feb 2025 21:47:14 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agoxfs/27[24]: adapt for checking files on the realtime volume
Darrick J. Wong [Thu, 20 Feb 2025 21:47:14 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agoxfs: create fuzz tests for the realtime refcount btree
Darrick J. Wong [Thu, 20 Feb 2025 21:47:14 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon/populate: create realtime refcount btree
Darrick J. Wong [Thu, 20 Feb 2025 21:47:14 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofuzzy: create missing fuzz tests for rt rmap btrees
Darrick J. Wong [Thu, 20 Feb 2025 21:47:13 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agopopulate: check that we created a realtime rmap btree of the given height
Darrick J. Wong [Thu, 20 Feb 2025 21:47:13 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agopopulate: adjust rtrmap calculations for rtgroups
Darrick J. Wong [Thu, 20 Feb 2025 21:47:13 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agoxfs/443: use file allocation unit, not dbsize
Darrick J. Wong [Thu, 20 Feb 2025 21:47:13 +0000 (13:47 -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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>