]> www.infradead.org Git - users/hch/xfstests-dev.git/log
users/hch/xfstests-dev.git
8 months agovarious: fix finding metadata inode numbers when metadir is enabled
Darrick J. Wong [Tue, 6 Feb 2024 00:06:37 +0000 (16:06 -0800)]
various: fix finding metadata inode numbers when metadir is enabled

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

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

Fix xfs/122 to work properly with metadirino.

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

Test the ability to add older v5 features.

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

Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agosrc/fiexchange.h: add the start-commit/commit-range ioctls
Darrick J. Wong [Thu, 29 Feb 2024 00:17:45 +0000 (16:17 -0800)]
src/fiexchange.h: add the start-commit/commit-range ioctls

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

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: functional testing for filesystem properties
Darrick J. Wong [Thu, 25 Jul 2024 21:07:37 +0000 (14:07 -0700)]
xfs: functional testing for filesystem properties

Make sure that fs property storage and retrieval actually work.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: bothrepair fuzz test known output
Darrick J. Wong [Tue, 6 Feb 2024 00:06:32 +0000 (16:06 -0800)]
xfs: bothrepair fuzz test known output

Record all the currently known failures of the online-then-offline
repair code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: norepair fuzz test known output
Darrick J. Wong [Tue, 6 Feb 2024 00:06:31 +0000 (16:06 -0800)]
xfs: norepair fuzz test known output

Record all the currently known failures of the kernel verifier code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: offline fuzz test known output
Darrick J. Wong [Tue, 6 Feb 2024 00:06:31 +0000 (16:06 -0800)]
xfs: offline fuzz test known output

Record all the currently known failures of the xfs_repair check and
repair code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: online fuzz test known output
Darrick J. Wong [Tue, 6 Feb 2024 00:06:30 +0000 (16:06 -0800)]
xfs: online fuzz test known output

Record all the currently known failures of the xfs_scrub check and
repair code when parent pointers and rtgroups are enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs/004: fix column extraction code
Darrick J. Wong [Tue, 6 Feb 2024 00:06:33 +0000 (16:06 -0800)]
xfs/004: fix column extraction code

Now that the xfs_db freesp command prints a CDF of the free space
histograms, fix the pct column extraction code to handle the two
new columns by <cough> using awk.

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

Create a pair of new tests that check that xfs_scrub and xfs_scrub_all
will find and test mounted filesystems.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agogeneric/453: check xfs_scrub detection of confusing job offers
Darrick J. Wong [Tue, 6 Feb 2024 00:06:33 +0000 (16:06 -0800)]
generic/453: check xfs_scrub detection of confusing job offers

Earlier this year, ESET revealed that Linux users had been tricked into
opening executables containing malware payloads.  The trickery came in
the form of a malicious zip file containing a filename with the string
"job offer․pdf".  Note that the filename does *not* denote a real pdf
file, since the last four codepoints in the file name are "ONE DOT
LEADER", p, d, and f.  Not period (ok, FULL STOP), p, d, f like you'd
normally expect.

Now that xfs_scrub can look for codepoints that could be confused with a
period followed by alphanumerics, let's make sure it actually works.

Link: https://www.welivesecurity.com/2023/04/20/linux-malware-strengthens-links-lazarus-3cx-supply-chain-attack/
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agogeneric/453: test confusable name detection with 32-bit unicode codepoints
Darrick J. Wong [Tue, 6 Feb 2024 00:06:32 +0000 (16:06 -0800)]
generic/453: test confusable name detection with 32-bit unicode codepoints

Test the confusable name detection when there are 32-bit unicode
sequences in use.  In other words, emoji.  Change the xfs_scrub test to
dump the output to a file instead of passing huge echo commands around.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
8 months agoxfs: remove all traces of xfs_check
Darrick J. Wong [Wed, 24 Jul 2024 17:43:48 +0000 (10:43 -0700)]
xfs: remove all traces of xfs_check

xfsprogs stopped shipping xfs_check (the wrapper script) in May 2014.
It's now been over a decade since it went away, and its replacements
(xfs_repair and xfs_scrub) now detect a superset of the problems that
check can find.

There is no longer any point in invoking xfs_check, so let's remove it
from fstests completely.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
8 months agoxfs: test online repair when xfiles consists of THPs
Darrick J. Wong [Tue, 6 Feb 2024 00:07:01 +0000 (16:07 -0800)]
xfs: test online repair when xfiles consists of THPs

Fork xfs/286 so that we can ensure that the xfile and xmbuf code in
fsck can handle THPs and large folios.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
9 months agogeneric/754: fix _fixed_by tags
Darrick J. Wong [Fri, 26 Jul 2024 16:51:07 +0000 (09:51 -0700)]
generic/754: fix _fixed_by tags

This test requires an xfs_repair patch, so note that in the test.  Also
update the kernel git hash since we now have one.

Reported-by: maxj.fnst@fujitsu.com
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoxfs: add a few more tests to the repair group
Christoph Hellwig [Mon, 15 Jul 2024 05:38:37 +0000 (07:38 +0200)]
xfs: add a few more tests to the repair group

Add a bunch of tests that test repair for the RT subvolume to the repair
group.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoxfs/011: support byte-based grant heads are stored in bytes now
Christoph Hellwig [Mon, 15 Jul 2024 06:24:53 +0000 (08:24 +0200)]
xfs/011: support byte-based grant heads are stored in bytes now

New kernels where reservation grant track the actual reservation space
consumed in bytes instead of LSNs in cycle/block tuples export different
sysfs files for this information.

Adapt the test to detect which version is exported, and simply check
for a near-zero reservation space consumption for the byte based version.

Based on work from Dave Chinner.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agof2fs: test for race condition in between atomic_write and dio
Chao Yu [Sat, 20 Jul 2024 07:45:40 +0000 (15:45 +0800)]
f2fs: test for race condition in between atomic_write and dio

Test that we will simulate sqlite atomic write logic w/ below steps:
1. create a regular file, and initialize it w/ 0xff data
2. start transaction (via F2FS_IOC_START_ATOMIC_WRITE) on it
3. write transaction data
4. trigger direct read/write IO to check whether it fails or not
5. commit and end the transaction (via F2FS_IOC_COMMIT_ATOMIC_WRITE)
This is a regression test to check handling of race condition in
between atomic_write and direct IO.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agof2fs: test for race condition in between atomic_write and gc
Chao Yu [Sat, 20 Jul 2024 07:43:16 +0000 (15:43 +0800)]
f2fs: test for race condition in between atomic_write and gc

Test that we will simulate sqlite atomic write logic w/ below steps:
1. create a regular file, and initialize it w/ 0xff data
2. start transaction (via F2FS_IOC_START_ATOMIC_WRITE) on it
3. write transaction data
4. trigger foreground GC to migrate data block of the file
5. commit and end the transaction
6. check consistency of transaction
This is a regression test to check handling of race condition in
between atomic_write and GC.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agobtrfs: properly shutdown subvolume stress worker to avoid umount failures
Filipe Manana [Wed, 24 Jul 2024 13:58:52 +0000 (14:58 +0100)]
btrfs: properly shutdown subvolume stress worker to avoid umount failures

When killing a test that is using the subvolume stress worker, we may end
up in a situation where we end up leaving a subvolume mounted which makes
the shutdown sequence fail. Example when killing a script that keeps
running fstests in a loop:

   FSTYP         -- btrfs
   PLATFORM      -- Linux/x86_64 debian0 6.10.0-rc7-btrfs-next-167+ #1 SMP PREEMPT_DYNAMIC Thu Jul 11 17:54:07 WEST 2024
   MKFS_OPTIONS  -- /dev/sdc
   MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

   (...)
   btrfs/065 23s ... ^C^C^C
   Iteration 134, errors 1, leaks 0, Wed Jul 24 12:14:33 PM WEST 2024, flakey errors: 0 MKFS_OPTIONS="" MOUNT_OPTIONS=""

   SCRATCH_DEV=/dev/sdc is mounted but not on SCRATCH_MNT=/home/fdmanana/btrfs-tests/scratch_1 - aborting
   Already mounted result:
   /dev/sdc /home/fdmanana/btrfs-tests/scratch_1 /dev/sdc /home/fdmanana/btrfs-tests/dev/065.mnt
   grep: results/btrfs/065.out.bad: No such file or directory
   Error iteration 134, total errors 2, leaks 0
   'results/btrfs/065.full' -> '/home/fdmanana/failures/btrfs_065/134/065.full'

Running 'mount' to see what's going on:

   $ mount
   (...)
   /dev/sdb on /home/fdmanana/btrfs-tests/dev type btrfs (rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/)
   /dev/sdc on /home/fdmanana/btrfs-tests/scratch_1 type btrfs (rw,relatime,discard=async,space_cache=v2,subvolid=5,subvol=/)
   /dev/sdc on /home/fdmanana/btrfs-tests/dev/065.mnt type btrfs (rw,relatime,discard=async,space_cache=v2,subvolid=2627,subvol=/subvol_3395330)

Then this makes the next attempt to run a test (./check) always fail due
to the extra mount of the subvolume, requiring one to manually umount the
subvolume before running fstests again.

So update _btrfs_kill_stress_subvolume_pid() to also unmount the subvolume.

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>
9 months agofstests: btrfs/012: fix a false alert due to socket/pipe files
Qu Wenruo [Wed, 17 Jul 2024 22:54:49 +0000 (08:24 +0930)]
fstests: btrfs/012: fix a false alert due to socket/pipe files

[BUG]
On my Archlinux VM, the test btrfs/012 always fail with the following
output diff:

     QA output created by 012
    +File /etc/pacman.d/gnupg/S.dirmngr is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.dirmngr is a socket
    +File /etc/pacman.d/gnupg/S.gpg-agent is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.gpg-agent is a socket
    +File /etc/pacman.d/gnupg/S.gpg-agent.browser is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.gpg-agent.browser is a socket
    +File /etc/pacman.d/gnupg/S.gpg-agent.extra is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.gpg-agent.extra is a socket
    +File /etc/pacman.d/gnupg/S.gpg-agent.ssh is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.gpg-agent.ssh is a socket
    +File /etc/pacman.d/gnupg/S.keyboxd is a socket while file /mnt/scratch/etc/pacman.d/gnupg/S.keyboxd is a socket
    ...

[CAUSE]
It's a false alerts.

When diff hits two files which are not directory/softlink/regular files
(aka, socket/pipe/char/block files), they are all treated as
non-comparable.
In that case, diff would just do the above message.

And with Archlinux, pacman (the package manager) maintains its gpg
directory inside "/etc/pacman.d/gnupg", and the test case uses
"/etc" as the source directory to populate the target ext4 fs.

And the socket files inside "/etc/pacman.d/gnupg" is causing the false
alerts.

[FIX]
- Use fsstress to populate the fs
  That covers all kind of operations, including creating special files.
  And fsstress is very reproducible, with the seed saved to the full
  log, it's much easier to reproduce than using the distro dependent
  "/etc/" directory.

- Use fssum to save the digest and later verify the contents
  It does not only verify the contents but also other things like
  timestamps/xattrs/uid/gid/mode/etc.
  And it's more comprehensive than the content oriented diff tool.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
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>
9 months agobtrfs: test a compressed send stream scenario that triggered a read corruption
Filipe Manana [Tue, 16 Jul 2024 10:14:45 +0000 (11:14 +0100)]
btrfs: test a compressed send stream scenario that triggered a read corruption

Test a scenario of a compressed send stream that triggered a bug in the
extent map merging code introduced in the merge window for 6.11.

The commit that introduced the bug is on its way to Linus' tree and its
subject is:

   "btrfs: introduce new members for extent_map"

The corresponding fix was submitted to the btrfs mailing list, with the
subject:

  "btrfs: fix corrupt read due to bad offset of a compressed extent map"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
9 months agobtrfs/220: remove integrity checker bits
David Sterba [Thu, 18 Jul 2024 15:57:54 +0000 (17:57 +0200)]
btrfs/220: remove integrity checker bits

We've deleted the integrity checker code in 6.8, no point testing it.

Signed-off-by: David Sterba <dsterba@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>
9 months agobtrfs/081: wait for reader process to exit before cycle mounting
Filipe Manana [Fri, 28 Jun 2024 17:04:49 +0000 (18:04 +0100)]
btrfs/081: wait for reader process to exit before cycle mounting

We send a kill signal to the reader process, check the md5sum of the
files and then cycle mount the scratch device. Most of the time the
reader process has already terminated before we attempt the cycle mount,
but sometimes it may still be alive in which case the cat command
executed by the reader process may fail because the scratch fs was
unmounted and the target file doesn't exist. This makes the cat command
print an error message and the test fail like this:

     Verifying file digests after cloning
     14968c092c68e32fa35e776392d14523  SCRATCH_MNT/foo
     14968c092c68e32fa35e776392d14523  SCRATCH_MNT/bar
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    ...
    (Run diff -u /opt/xfstests/tests/btrfs/081.out

Fix this by making the test wait for the reader to terminate after
sending it the kill signal.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agofstests: btrfs/029: add fixes for the kernel behavior change
Qu Wenruo [Wed, 10 Jul 2024 23:42:55 +0000 (09:12 +0930)]
fstests: btrfs/029: add fixes for the kernel behavior change

Since fstests commit 866948e00073 ("btrfs/029: change the cross vfsmount
reflink test"), the test case will fail for older kernels (e.g. 5.14
kernels from SLE).

The failure is a false alert, but it would still take some time to
figure it out.
So add the fixes tag to make it more clear that it's a kernel behavior
change.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agobtrfs: fix _require_btrfs_send_version to detect btrfs-progs support
Filipe Manana [Fri, 12 Jul 2024 09:54:24 +0000 (10:54 +0100)]
btrfs: fix _require_btrfs_send_version to detect btrfs-progs support

Commit 199d0a992536df3702a0c4843d2a449d54f399c2 ("common/btrfs: introduce
_require_btrfs_send_version") turned _require_btrfs_send_v2 into a generic
helper to detect support for any send stream version, however it's only
working for detecting kernel support, it misses detecting the support from
btrfs-progs - it always checks only that it supports v2 (the send command
supports the --compressed-data option).

Fix that by verifying that btrfs-progs supports the requested version.

Reviewed-by: Qu Wenruo <wqu@suse.com>
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>
9 months agobtrfs: add test for subvolid reuse with squota
Boris Burkov [Tue, 9 Jul 2024 17:51:04 +0000 (10:51 -0700)]
btrfs: add test for subvolid reuse with squota

Squotas are likely to leave qgroups that outlive deleted subvolids.
Before the kernel patch
2b8aa78cf127 ("btrfs: qgroup: fix qgroup id collision across mounts")
this would lead to a repeated subvolid which would collide on an
existing qgroup id and error out with EEXIST. In snapshot creation, this
would lead to a read only fs.

Add a test which exercises the path that could create duplicate
subvolids but with squotas enabled, which should avoid the trap.

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
[zlang: Remove _supported_fs line]

9 months agobtrfs: update golden output of RST test cases
Johannes Thumshirn [Mon, 1 Jul 2024 08:01:09 +0000 (10:01 +0200)]
btrfs: update golden output of RST test cases

Starting with kernel patch "btrfs: remove raid-stripe-tree
encoding field from stripe_extent" and btrfs-progs commit
7c549b5f7cc0 ("btrfs-progs: remove raid stripe encoding"), the on-disk
format of the raid stripe tree got changed.

As the feature is still experimental and not to be used in production, it
is OK to do a on-disk format change.

Update the golden output of the RAID stripe tree test cases after the
on-disk format and print format changes.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
9 months agoremove spurious _supported_fs calls
Christoph Hellwig [Sun, 23 Jun 2024 12:10:37 +0000 (14:10 +0200)]
remove spurious _supported_fs calls

Remove _supported_fs calls for generic in the generic directory
or for $FSTYP in the $FSTYP directory.

This leaves us with the negative checks, and the overloaded ext4
directory where some tests can also be run for ext2 and ext3.

While at it also remove the pointless "real QA test starts here"
usually placed right next to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/746: clean up fs support
Christoph Hellwig [Sun, 23 Jun 2024 12:10:36 +0000 (14:10 +0200)]
generic/746: clean up fs support

Use a single case statement for fs-specific options and to check if
this test is supported at all.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/745: rework support fs checking
Christoph Hellwig [Sun, 23 Jun 2024 12:10:35 +0000 (14:10 +0200)]
generic/745: rework support fs checking

To prepare for deprecating _supported_fs use a case statement and
_notrun.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/740: enable by default
Christoph Hellwig [Sun, 23 Jun 2024 12:10:34 +0000 (14:10 +0200)]
generic/740: enable by default

Instead of limiting this test to a few file systems, opt out the
file systems supported in common/rc that don't support overwrite
checking at all, and those like extN that support it, but only when
run interactively.

Also remove support for really old mkfs.btrfs versions that lack
the overwrite check.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/740: skip jffs2 as foreign fs earlier
Christoph Hellwig [Sun, 23 Jun 2024 12:10:33 +0000 (14:10 +0200)]
generic/740: skip jffs2 as foreign fs earlier

Commit a633d252e3c4 ("shared/032: add options for jffs2") added a
check to skip checking the overwrite of jffs2, but only after
adding specific mkfs options for it and zeroing part of the device.

Switch to skipping it earlier in a more obvious place.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/740: pass the --quick option to mkfs.ntfs
Christoph Hellwig [Sun, 23 Jun 2024 12:10:32 +0000 (14:10 +0200)]
generic/740: pass the --quick option to mkfs.ntfs

Without --quick mkfs.ntfs will zero the entire device, which can take
a very long time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agogeneric/740: clean up handling of mkfs options
Christoph Hellwig [Sun, 23 Jun 2024 12:10:31 +0000 (14:10 +0200)]
generic/740: clean up handling of mkfs options

Use a single case statement instead of lots of conditionals.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoremove support for ext4dev
Christoph Hellwig [Sun, 23 Jun 2024 12:10:30 +0000 (14:10 +0200)]
remove support for ext4dev

ext4dev is a long deprecated alias for ext4 that was used during early
ext4 development.  Drop support for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoxfs/242: fix test failure due to incorrect filtering in _filter_bmap
Long Li [Fri, 12 Jul 2024 06:47:16 +0000 (14:47 +0800)]
xfs/242: fix test failure due to incorrect filtering in _filter_bmap

I got a failure in xfs/242 as follows, it can be easily reproduced
when I run xfs/242 as a cyclic test.

  13. data -> unwritten -> data
  0: [0..127]: data
  -1: [128..511]: unwritten
  -2: [512..639]: data
  +1: [128..639]: unwritten

The root cause, as Dave pointed out in previous email [1], is that
_filter_bmap may incorrectly match the AG-OFFSET in column 5 for datadev
files. On the other hand, _filter_bmap missing a "next" to jump out when
it matches "data" in the 5th column, otherwise it might print the result
twice. The issue was introduced by commit 7d5d3f77154e ("xfs/242: fix
_filter_bmap for xfs_io bmap that does rt file properly"). The failure
disappeared when I retest xfs/242 by reverted commit 7d5d3f77154e.

Fix it by matching the 7th column first and then the 5th column in
_filter_bmap, because the rtdev file only has 5 columns in the `bmap -vp`
output.

[1] https://lore.kernel.org/all/Zh9UkHEesvrpSQ7J@dread.disaster.area/

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoxfs/016: fix test fail when head equal to near_end_min
Long Li [Fri, 12 Jul 2024 06:47:15 +0000 (14:47 +0800)]
xfs/016: fix test fail when head equal to near_end_min

xfs/016 checks for corruption in the log when it wraps. It looks for a log
head that is at or above the minimum log size. If the final position of
the log head equals near_end_min, the test will fail. Under these
conditions, we should let the test continue.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agofiexchange.h: update XFS_IOC_EXCHANGE_RANGE again
Darrick J. Wong [Wed, 3 Jul 2024 21:36:45 +0000 (14:36 -0700)]
fiexchange.h: update XFS_IOC_EXCHANGE_RANGE again

We corrected the definition for XFS_IOC_EXCHANGE_RANGE towards the end
of 6.10, so do it again.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
9 months agoxfs/444: fix agfl reset warning detection for small log buffers
Darrick J. Wong [Wed, 3 Jul 2024 21:36:05 +0000 (14:36 -0700)]
xfs/444: fix agfl reset warning detection for small log buffers

Collectively, the ten subtests in xfs/444 can generate a lot of kernel
log data.  If the amount of log data is enough to overflow the kernel
log buffers, the AGFL reset warning generated by fix_start and fix_wrap
might have been overwritten by subsequent log data.  Fix this by
checking for the reset warning after each test and only complaining if
at the end if we have /never/ seen the warning.

Found by running on a kernel configured with CONFIG_LOG_BUF_SHIFT=14
(16K).  This happened to be a Raspberry Pi, but in principle this can
happen to anyone.  I'd never noticed this before because x86 helpfully
sets it to 17 (128K) by default.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric: test creating and removing symlink xattrs
Darrick J. Wong [Thu, 20 Jun 2024 21:01:06 +0000 (14:01 -0700)]
generic: test creating and removing symlink xattrs

This began as a regression test for the issues identified in "xfs: allow
symlinks with short remote targets".  To summarize, the kernel XFS code
does not convert a remote symlink back to a shortform symlink after
deleting the attr fork.  Recent attempts to tighten validation have
flagged this incorrectly, so we need a regression test to focus on this
dusty corner of the codebase.

However, there's nothing in here that's xfs-specific so it's a generic
test.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/348: partially revert dbcc549317 ("xfs/348: golden output is not correct")
Dave Chinner [Thu, 20 Jun 2024 21:00:50 +0000 (14:00 -0700)]
xfs/348: partially revert dbcc549317 ("xfs/348: golden output is not correct")

In kernel commit 1eb70f54c445f ("xfs: validate inode fork size against
fork format"), we incorrectly started flagging as corrupt symlinks with
short targets that would fit in the inode core but are remote.  The
kernel has historically written out symlinks this way and read them back
in, so we're fixing that.

The 1eb70 change came with change dbcc to fstests to adjust the golden
output; since we're adjusting the kernel back to old behavior, we need
to adjust the test too.

Fixes: dbcc549317 ("xfs/348: golden output is not correct")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/122: update for vectored scrub
Darrick J. Wong [Thu, 20 Jun 2024 21:00:35 +0000 (14:00 -0700)]
xfs/122: update for vectored scrub

Add the two new vectored scrub structures.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoscrub: test correction of directory tree corruptions
Darrick J. Wong [Thu, 20 Jun 2024 21:00:19 +0000 (14:00 -0700)]
scrub: test correction of directory tree corruptions

Make sure that we can fix directory tree loops and multiply-owned dirs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agocommon/fuzzy: stress directory tree modifications with the dirtree tester
Darrick J. Wong [Thu, 20 Jun 2024 21:00:03 +0000 (14:00 -0700)]
common/fuzzy: stress directory tree modifications with the dirtree tester

Stress test the directory tree corruption detector by racing it 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>
10 months agoxfs: add parent pointer inject test
Allison Henderson [Thu, 20 Jun 2024 20:59:48 +0000 (13:59 -0700)]
xfs: add parent pointer inject test

Add a test to verify parent pointers after an error injection and log
replay.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs: add multi link parent pointer test
Allison Henderson [Thu, 20 Jun 2024 20:59:32 +0000 (13:59 -0700)]
xfs: add multi link parent pointer test

Add a test to verify parent pointers while multiple links to a file are
created and removed.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs: add parent pointer test
Allison Henderson [Thu, 20 Jun 2024 20:59:16 +0000 (13:59 -0700)]
xfs: add parent pointer test

Add a test to verify basic parent pointers operations (create, move, link,
unlink, rename, overwrite).

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: test the xfs_io parent -p argument too]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agocommon: add helpers for parent pointer tests
Allison Henderson [Thu, 20 Jun 2024 20:59:01 +0000 (13:59 -0700)]
common: add helpers for parent pointer tests

Add helper functions in common/parent to parse and verify parent
pointers. Also add functions to check that mkfs, kernel, and xfs_io
support parent pointers.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: add license and copyright, dont _fail tests immediately, make
 sure the pptr-generated paths match the dir-generated paths]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/306: fix formatting failures with parent pointers
Darrick J. Wong [Thu, 20 Jun 2024 20:58:45 +0000 (13:58 -0700)]
xfs/306: fix formatting failures with parent pointers

The parent pointers feature isn't supported on tiny 20MB filesystems
because the larger directory transactions result in larger minimum log
sizes, particularly with nrext64 enabled:

** mkfs failed with extra mkfs options added to " -m rmapbt=0, -i nrext64=1, -n parent=1," by test 306 **
** attempting to mkfs using only test 306 options: -d size=20m -n size=64k **
max log size 5108 smaller than min log size 5310, filesystem is too small

We don't support 20M filesystems anymore, so bump the filesystem size up
to 100M and skip this test if we can't actually format the filesystem.
Convert the open-coded punch-alternating logic into a call to that
program to reduce execve overhead, which more than makes up having to
write 5x as much data to fragment the free space.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/{018,191,288}: disable parent pointers for these tests
Darrick J. Wong [Thu, 20 Jun 2024 20:58:29 +0000 (13:58 -0700)]
xfs/{018,191,288}: disable parent pointers for these tests

These tests depend heavily on the xattr formats created for new files.
Parent pointers break those assumptions, so force parent pointers off.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/021: adapt golden output files for parent pointers
Darrick J. Wong [Thu, 20 Jun 2024 20:58:13 +0000 (13:58 -0700)]
xfs/021: adapt golden output files for parent pointers

Parent pointers change the xattr structure dramatically, so fix this
test to handle them.  For the most part we can get away with filtering
out the parent pointer fields (which xfs_db decodes for us), but the
namelen/valuelen/attr_filter fields still show through.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agopopulate: create hardlinks for parent pointers
Darrick J. Wong [Thu, 20 Jun 2024 20:57:58 +0000 (13:57 -0700)]
populate: create hardlinks for parent pointers

Create some hardlinked files so that we can exercise parent pointers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/122: update for parent pointers
Darrick J. Wong [Thu, 20 Jun 2024 20:57:42 +0000 (13:57 -0700)]
xfs/122: update for parent pointers

Update test for parent pointers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/206: filter out the parent= status from mkfs
Darrick J. Wong [Thu, 20 Jun 2024 20:57:27 +0000 (13:57 -0700)]
xfs/206: filter out the parent= status from mkfs

Filter out the parent pointer bits from the mkfs output so that we don't
cause a regression in this test.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric: test recovery of extended attribute updates
Darrick J. Wong [Thu, 20 Jun 2024 20:57:11 +0000 (13:57 -0700)]
generic: test recovery of extended attribute updates

Fork generic/475 to test recovery of extended attribute modifications
and log recovery.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoexchangerange: make sure that we don't swap unwritten extents unless they're part...
Darrick J. Wong [Thu, 20 Jun 2024 20:56:55 +0000 (13:56 -0700)]
exchangerange: make sure that we don't swap unwritten extents unless they're part of a rt extent

By default, the FILE1_WRITTEN flag for the EXCHANGERANGE ioctl isn't
supposed to touch anything except for written extents.  In other words,
it shouldn't exchange delalloc reservations, unwritten preallocations,
or holes.  The XFS implementation flushes dirty pagecache to disk so
there should never be delalloc reservations running through the
exchangerange machinery, but there can be unwritten extents.

Hence, write a test to make sure that unwritten extents don't get moved
around.  This test opts itself out for realtime filesystems where the
allocation unit is larger than 1 fsblock because xfs has to move full
allocation units, and that requires exchanging of partially written rt
extents.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/206: screen out exchange-range from golden output
Darrick J. Wong [Thu, 20 Jun 2024 20:56:40 +0000 (13:56 -0700)]
xfs/206: screen out exchange-range from golden output

Fix this so that exchange-range doesn't trigger test failures.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/122: fix for exchrange conversion
Darrick J. Wong [Thu, 20 Jun 2024 20:56:24 +0000 (13:56 -0700)]
xfs/122: fix for exchrange conversion

Fix this test for the swapext -> exchrange conversion.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agosrc/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions
Darrick J. Wong [Thu, 20 Jun 2024 20:56:08 +0000 (13:56 -0700)]
src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions

Update to use our new file content exchange ioctl definitions.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agomisc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic
Darrick J. Wong [Thu, 20 Jun 2024 20:55:53 +0000 (13:55 -0700)]
misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic

We only need to include src/fiexchange.h if the system's xfslibs package
either doesn't define it or is so old that we want a newer definition.
Invert the logic so that we only use src/fiexchange if we need the
override.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoltp/{fsstress,fsx}: make the exchangerange naming consistent
Darrick J. Wong [Thu, 20 Jun 2024 20:55:37 +0000 (13:55 -0700)]
ltp/{fsstress,fsx}: make the exchangerange naming consistent

xchg_range/xchgrange -> exchangerange, since that's what the name has
become.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/717: remove obsolete check
Darrick J. Wong [Thu, 20 Jun 2024 20:55:21 +0000 (13:55 -0700)]
generic/717: remove obsolete check

The final version of the EXCHANGERANGE ioctl has dropped the flag that
enforced that the two files being operated upon were exactly the same
length as was specified in the ioctl parameters.  Remove this check
since it's now defunct.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/711,xfs/537: actually fork these tests for exchange-range
Darrick J. Wong [Thu, 20 Jun 2024 20:55:06 +0000 (13:55 -0700)]
generic/711,xfs/537: actually fork these tests for exchange-range

Fork g/711 to g/752, x/537 to x/615. These tests to check the same
things with exchange-range as they do for swapext, since the code
porting swapext to commit-range has been dropped.

I was going to fork xfs/789 as well, but it turns out that generic/714
covers this sufficiently so for that one, we just strike fiexchange
from the group tag.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/709,710: rework these for exchangerange vs. quota testing
Darrick J. Wong [Thu, 20 Jun 2024 20:54:50 +0000 (13:54 -0700)]
generic/709,710: rework these for exchangerange vs. quota testing

The exchange-range implementation is now completely separate from the
old swapext ioctl, so let's migrate these quota tests to exchangerange.

There's no point in maintaining these tests for the legacy swapext code
because it returns EINVAL if any quota is enabled and the two files have
different user/group/project ids.  Originally I had forward ported the
old swapext ioctl to use commitrange as its backend, but that will be
dropped in favor of porting xfs_fsr to use commitrange directly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agomisc: change xfs_io -c swapext to exchangerange
Darrick J. Wong [Thu, 20 Jun 2024 20:54:34 +0000 (13:54 -0700)]
misc: change xfs_io -c swapext to exchangerange

Update the swapext command to use exchangerange as part of severing the
connection between the two ioctls.

Flags changed:

-h (only exchange written extents) is now -w.

-a (atomic mode) is always enabled now.

-e (to eof) is now the default; -l (length) disables this flag.

-u (unconditonal swap) is inverted to -c (commit only if fresh).

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agomisc: split swapext and exchangerange
Darrick J. Wong [Thu, 20 Jun 2024 20:54:19 +0000 (13:54 -0700)]
misc: split swapext and exchangerange

These two commands (and the kernel implementations) are splitting, so we
need to split the xfs_io usage.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs: test scaling of the mkfs concurrency options
Darrick J. Wong [Thu, 20 Jun 2024 20:54:03 +0000 (13:54 -0700)]
xfs: test scaling of the mkfs concurrency options

Make sure that the AG count and log size scale up with the new
concurrency options to mkfs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/574: test corruption at more offsets
Eric Biggers [Wed, 12 Jun 2024 03:53:34 +0000 (20:53 -0700)]
generic/574: test corruption at more offsets

Expand generic/574 to test for corruption in more different parts of the
file to try to exercise any hashing optimizations that might be used.

There is no existing bug that this finds.  This is just to prevent
future bugs, considering optimizations along the lines of
https://lore.kernel.org/fsverity/20240611034822.36603-7-ebiggers@kernel.org/

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/073: avoid large recursive diff
Christoph Hellwig [Thu, 20 Jun 2024 12:48:44 +0000 (14:48 +0200)]
xfs/073: avoid large recursive diff

xfs/073 has been failing for me for a while on most of my test setups
with:

diff: memory exhausted

from the large recursive diff it does.  Replace that with a pipe using
md5sum to reduce the memory usage.

Based on a snipplet from Darrick Wong.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofstests: add stress truncation + writeback test
Luis Chamberlain [Sat, 15 Jun 2024 00:29:34 +0000 (17:29 -0700)]
fstests: add stress truncation + writeback test

Stress test folio splits by using the new debugfs interface to a target
a new smaller folio order while triggering writeback at the same time.

This is known to only creates a crash with min order enabled, so for example
with a 16k block sized XFS test profile, an xarray fix for that is merged
already. This issue is fixed by kernel commit 2a0774c2886d ("XArray: set the
marks correctly when splitting an entry").

If inspecting more closely, you'll want to enable on your kernel boot:

dyndbg='file mm/huge_memory.c +p'

Since we want to race large folio splits we also augment the full test
output log $seqres.full with the test specific number of successful
splits from vmstat thp_split_page and thp_split_page_failed. The larger
the vmstat thp_split_page the more we stress test this path.

This test reproduces a really hard to reproduce crash immediately.

[zlang: add _require_debugfs into _require_split_huge_pages_knob]

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months ago_require_debugfs(): simplify and fix for debian
Luis Chamberlain [Sat, 15 Jun 2024 00:29:33 +0000 (17:29 -0700)]
_require_debugfs(): simplify and fix for debian

Using findmnt -S debugfs arguments does not really output anything on
debian, and is not needed, fix that.

Fixes: 8e8fb3da709e ("fstests: fix _require_debugfs and call it properly")
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofstests: add fsstress + compaction test
Luis Chamberlain [Sat, 15 Jun 2024 00:29:32 +0000 (17:29 -0700)]
fstests: add fsstress + compaction test

Running compaction while we run fsstress can crash older kernels as per
korg#218227 [0], the fix for that [0] has been posted [1] that patch
was merged on v6.9-rc6 fixed by commit d99e3140a4d3 ("mm: turn
folio_test_hugetlb into a PageType"). This test reproduces that crash
right away.

But we have more work to do ...

Even on v6.10-rc2 where this kernel commit is already merged we can
still deadlock when running fsstress and at the same time triggering
compaction, this is a new issue being reported now through this patch,
but this patch also serves as a reproducer with a high confidence. At
least for XFS running this test ~ 44 times will deadlock.

If you enable CONFIG_PROVE_LOCKING with the defaults you will end up
with a complaint about increasing MAX_LOCKDEP_CHAIN_HLOCKS [1], if
you adjust that you then end up with a few soft lockup complaints and
some possible deadlock candidates to evaluate [2].

Provide a simple reproducer and pave the way so we keep on testing this.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=218227
[1] https://gist.github.com/mcgrof/824913b645892214effeb1631df75072
[2] https://gist.github.com/mcgrof/926e183d21c5c4c55d74ec90197bd77a

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofstests: add mmap page boundary tests
Luis Chamberlain [Sat, 15 Jun 2024 00:29:31 +0000 (17:29 -0700)]
fstests: add mmap page boundary tests

mmap() POSIX compliance says we should zero fill data beyond a file
size up to page boundary, and issue a SIGBUS if we go beyond. While fsx
helps us test zero-fill sometimes, fsstress also let's us sometimes test
for SIGBUS however that is based on a random value and its not likely we
always test it. Dedicate a specic test for this to make testing for
this specific situation and to easily expand on other corner cases.

The only filesystem currently known to fail is tmpfs with huge pages on
a 4k base page size system, on 64k base page size it does not fail.
The pending upstream patch "filemap: cap PTE range to be created to
allowed zero fill in folio_map_range()" fixes this issue for tmpfs on
4k base page size with huge pages and it also fixes it for LBS support.

Suggested-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agocommon: move mread() to generic helper _mread()
Luis Chamberlain [Sat, 15 Jun 2024 00:29:30 +0000 (17:29 -0700)]
common: move mread() to generic helper _mread()

We want a shared way to use mmap in a way that we can test
for the SIGBUS, provide a shared routine which other tests can
leverage.

Suggested-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/455: skip the test if the file system doesn't support journaling
Theodore Ts'o [Tue, 11 Jun 2024 22:26:59 +0000 (18:26 -0400)]
generic/455: skip the test if the file system doesn't support journaling

This test uses dm-log-writes to test power fail scenarios, so it won't
work if the file system doesn't support metadata journaling.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoext4/045: use the large_dir feature to fix test failures with a 1k block size
Theodore Ts'o [Tue, 11 Jun 2024 22:26:58 +0000 (18:26 -0400)]
ext4/045: use the large_dir feature to fix test failures with a 1k block size

If the file system has a 1k blocksize, this test will fail without the
large_dir file system, because the depth of the dir_index tree needs
to be greater than 2.  So enable the large_dir unconditionally, which
also gives us better test coverage of the large_dir code paths.

As a result of requiring large_dir, this test will get skipped if the
kernel is older than 4.13 --- which was released in 2017; and that
seems to be reasonable at this point.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoext4/059: disable block_validity checks when mounting a corrupted file system
Theodore Ts'o [Wed, 23 Aug 2023 14:56:21 +0000 (10:56 -0400)]
ext4/059: disable block_validity checks when mounting a corrupted file system

Kernels with the commit "ext4: add correct group descriptors and
reserved GDT blocks to system zone" will refuse to mount the corrupted
file system constructed by this test.  So in order to perform the
test, we need to disable the block_validity checks.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-and-tested-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/74[3,8]: add git commit ID for the fixes
Filipe Manana [Mon, 17 Jun 2024 16:52:14 +0000 (17:52 +0100)]
generic/74[3,8]: add git commit ID for the fixes

The corresponding fixes landed in kernels 6.10-rc1 and 6.10-rc3, so update
the tests to point the commit IDs.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric: test Btrfs fsync vs. size-extending prealloc write crash
Omar Sandoval [Tue, 28 May 2024 17:13:14 +0000 (10:13 -0700)]
generic: test Btrfs fsync vs. size-extending prealloc write crash

This is a regression test for a Btrfs bug, but there's nothing
Btrfs-specific about it. Since it's a race, we just try to make the race
happen in a loop and pass if it doesn't crash after all of our attempts.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/077: ignore errors occurred while accessing the filler files
Luis Henriques (SUSE) [Wed, 5 Jun 2024 16:32:10 +0000 (17:32 +0100)]
generic/077: ignore errors occurred while accessing the filler files

When looking for data to fill in the filesystem, errors accessing files
may occur.  This will cause the test to fail as it'll show in the output
lines such as:

    du: cannot read directory '/usr/etc/sudoers.d': Permission denied

Ignoring these errors should be safe, so simply redirecting the stderr of
'du' to $seqres.full fixes it.  Unfortunately, this exposed a different
issue, which was the truncation of the $seqres.full file while copying files
into the filesystem.  This patch also fixes that.

Signed-off-by: "Luis Henriques (SUSE)" <luis.henriques@linux.dev>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofuzzy: test other dquot ids
Darrick J. Wong [Mon, 3 Jun 2024 20:12:58 +0000 (13:12 -0700)]
fuzzy: test other dquot ids

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofuzzy: allow FUZZ_REWRITE_DURATION to control fsstress runtime when fuzzing
Darrick J. Wong [Mon, 3 Jun 2024 20:12:42 +0000 (13:12 -0700)]
fuzzy: allow FUZZ_REWRITE_DURATION to control fsstress runtime when fuzzing

For each iteration of the fuzz test loop, we try to correct the problem,
and then we run fsstress on the (allegedly corrected) filesystem to
check that subsequent use of the filesystem won't crash the kernel or
panic.

Now that fsstress has a --duration switch, let's add a new config
variable that people can set to constrain the amount of time that a fuzz
test run takes.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agofuzzy: mask off a few more inode fields from the fuzz tests
Darrick J. Wong [Mon, 3 Jun 2024 20:12:27 +0000 (13:12 -0700)]
fuzzy: mask off a few more inode fields from the fuzz tests

XFS doesn't do any validation for filestreams, so don't waste time
fuzzing that.  Exclude the bigtime flag, since we already have inode
timestamps on the no-fuzz list.  Exclude the warning counters, since
they're defunct now.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agobtrfs/280: run defrag after creating file to get expected extent layout
Filipe Manana [Wed, 5 Jun 2024 11:26:20 +0000 (12:26 +0100)]
btrfs/280: run defrag after creating file to get expected extent layout

The test writes a 128M file and expects to end up with 1024 extents, each
with a size of 128K, which is the maximum size for compressed extents.
Generally this is what happens, but often it's possibly for writeback to
kick in while creating the file (due to memory pressure, or something
calling sync in parallel, etc) which may result in creating more and
smaller extents, which makes the test fail since its golden output
expects exactly 1024 extents with a size of 128K each.

So to work around run defrag after creating the file, which will ensure
we get only 128K extents in the file.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agobtrfs: fix raid-stripe-tree tests with non-experimental btrfs-progs build
Filipe Manana [Tue, 4 Jun 2024 12:14:48 +0000 (13:14 +0100)]
btrfs: fix raid-stripe-tree tests with non-experimental btrfs-progs build

When running the raid-stripe-tree tests with a btrfs-progs version that
was not configured with the experimental features, the tests fail because
they expect the dump tree commands to output the stored and calculated
checksums lines, which are enabled only for experimental builds.

Also, these lines exists only starting with btrfs-progs v5.17 (more
specifically since commit 1bb6fb896dfc ("btrfs-progs: btrfstune:
experimental, new option to switch csums")).

The tests fail like this on non-experimental btrfs-progs build:

   $ ./check btrfs/304
   FSTYP         -- btrfs
   PLATFORM      -- Linux/x86_64 debian0 6.9.0-btrfs-next-160+ #1 SMP PREEMPT_DYNAMIC Tue May 28 12:00:03 WEST 2024
   MKFS_OPTIONS  -- /dev/sdc
   MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

   btrfs/304 1s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad)
       --- tests/btrfs/304.out 2024-01-25 11:15:33.420769484 +0000
       +++ /home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad 2024-06-04 12:55:04.289903124 +0100
       @@ -8,8 +8,6 @@
        raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
        leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
        leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
       -checksum stored <CHECKSUM>
       -checksum calced <CHECKSUM>
        fs uuid <UUID>
        chunk uuid <UUID>
      ...
      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/304.out /home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad'  to see the entire diff)
   Ran: btrfs/304
   Failures: btrfs/304
   Failed 1 of 1 tests

So update _filter_stripe_tree() to remove the checksum lines, since we
don't care about them, and change the golden output of the tests to not
expect those lines. This way the tests work with both experimental and
non-experimental btrfs-progs builds, as well as btrfs-progs versions below
v5.17.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/747: redirect mkfs stderr to seqres.full
Darrick J. Wong [Mon, 3 Jun 2024 20:12:11 +0000 (13:12 -0700)]
generic/747: redirect mkfs stderr to seqres.full

ext4 fails on this test with:

  --- /tmp/fstests/tests/generic/747.out 2024-05-13 06:05:59.727025928 -0700
  +++ /var/tmp/fstests/generic/747.out.bad 2024-05-21 18:34:51.836000000 -0700
  @@ -1,4 +1,5 @@
   QA output created by 747
  +mke2fs 1.47.2~WIP-2024-05-21 (21-May-2024)
   Starting fillup using direct IO
   Starting mixed write/delete test using direct IO
   Starting mixed write/delete test using buffered IO

The reason for this is that mke2fs annoyingly prints the program version
to stderr, which messes up the golden output.  Fix this by redirecting
stderr like all the othe tests, even though this doesn't seem like a
great solution...

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agoxfs/008: use block size instead of the pagesize
Pankaj Raghav [Mon, 27 May 2024 11:48:34 +0000 (13:48 +0200)]
xfs/008: use block size instead of the pagesize

The testcase estimates to have ratio of 1:3/4 for holes:filesize. This
holds true where the blocksize is always less than or equal to pagesize
and the total size of the file is calculated based on the pagesize.
There is an implicit assumption that blocksize will always be less than
the pagesize.

LBS support will enable bs > ps where a minimum IO size is one block,
which can be greater than a page. Adjust the size calculation to be
based on the blocksize and not the pagesize.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
10 months agogeneric/436: round up bufsz to nearest filesystem blksz
Pankaj Raghav [Mon, 27 May 2024 11:48:33 +0000 (13:48 +0200)]
generic/436: round up bufsz to nearest filesystem blksz

SEEK_HOLE and SEEK_DATA work in filesystem block size granularity. So
while filling up the buffer for test 13 - 16, round up the bufsz to the
closest filesystem blksz.

As we only allowed blocksizes lower than the pagesize, this was never an
issue and it always aligned. Once we have blocksize > pagesize, this
assumption will break.

Fixes the test for LBS configuration.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.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>
10 months agoxfs/161: adapt the test case for 64k FS blocksize
Pankaj Raghav [Mon, 27 May 2024 11:48:32 +0000 (13:48 +0200)]
xfs/161: adapt the test case for 64k FS blocksize

This test fails when xfs is formatted with 64k filesystem block size*.
It fails because the soft quota is not exceeded with the hardcoded 64k
pwrite, thereby, the grace time is not set. Even though soft quota is
set to 12k for uid1, it is rounded up to the nearest blocksize.

*** Report for user quotas on device /dev/sdb3
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
0        --       0       0       0      0       3     0     0      0
1        --      64      64    1024      0       1     0     0      0
2        --      64       0       0      0       1     0     0      0

Adapt the pwrite to do twice the FS block size and set the soft limit
to be 1 FS block and hard limit to be 100 FS blocks. This also gets rid
of harcoded quota limit values.

* This happens even on a 64k pagesize system and it is not related to
  LBS effort.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agoRemove richacl support
David Sterba [Wed, 22 May 2024 17:30:48 +0000 (19:30 +0200)]
Remove richacl support

There's no support for richacl in Linux and based on information in the
links will never be. Remove all related files and support code.

References:
- https://wiki.samba.org/index.php/NFS4_ACL_overview#Linux
- https://lwn.net/Articles/661357/ (article, 2015)
- https://lwn.net/Articles/661078/ (patches, 2015)
- https://github.com/andreas-gruenbacher/richacl/
- http://www.bestbits.at/richacl/ (n/a anymore)

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agobtrfs/741: add commit ID in _fixed_by_kernel_commit
Anand Jain [Fri, 24 May 2024 04:26:59 +0000 (12:26 +0800)]
btrfs/741: add commit ID in _fixed_by_kernel_commit

Now that the kernel patch is merged in v6.9, replace the placeholder with
the actual commit ID.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months ago_test_mkfs: Include external log device (if any) when creating fs on TEST_DEV
Chandan Babu R [Fri, 24 May 2024 07:31:01 +0000 (13:01 +0530)]
_test_mkfs: Include external log device (if any) when creating fs on TEST_DEV

Test execution fails when testing XFS with external log device and when
RECREATE_TEST_DEV is set to true. This is because _test_mkfs() is invoked as
part of recreating the filesystem on test device and this function does not
include the external log device as part of the mkfs.xfs command line.

_test_mount() invoked later fails since it passes an external log device to
the mount syscall which the kernel does not expect to find.

To fix this bug, this commit modifies _test_mkfs() to invoke _test_options()
in order to compute the value of TEST_OPTIONS and includes the resulting value
in the mkfs.xfs command line.

Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agocheck: log kernel version in check.log
Carlos Maiolino [Wed, 22 May 2024 11:33:38 +0000 (13:33 +0200)]
check: log kernel version in check.log

After collecting several xfstests runs, it's useful to keep track on
which kernel a specific run happened.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agogeneric/733: add commit ID for btrfs
Filipe Manana [Tue, 21 May 2024 12:01:29 +0000 (13:01 +0100)]
generic/733: add commit ID for btrfs

As of commit 5d6f0e9890ed ("btrfs: stop locking the source extent range
during reflink"), btrfs now does reflink operations without locking the
source file's range, allowing concurrent reads in the whole source file.
So update the test to annotate that commit.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agogeneric/742: require FIEMAP support
Chen Hanxiao [Wed, 15 May 2024 09:21:33 +0000 (17:21 +0800)]
generic/742: require FIEMAP support

Some filesystems which don't support FIEMP fail on this test, e.g.
  FSTYP         -- nfs
  PLATFORM      -- xxxxxxxx
  MKFS_OPTIONS  -- xxxx-xxx-xxx:/mnt/xfstests/scratch/nfs-server
  MOUNT_OPTIONS -- -o vers=4.2 -o context=system_u:object_r:root_t:s0 xxxx-xxx-xxx:/mnt/xfstests/scratch/nfs-server /mnt/xfstests/scratch/nfs-client

  generic/742       [failed, exit status 1]- output mismatch (see /var/lib/xfstests/results//generic/742.out.bad)
      --- tests/generic/742.out 2024-05-12 10:48:02.502761852 -0400
      +++ /var/lib/xfstests/results//generic/742.out.bad 2024-05-12 21:10:48.412498322 -0400
      @@ -1,2 +1,3 @@
       QA output created by 742
       Silence is golden
      +fiemap-fault: fiemap failed 95: Operation not supported

So _notrun if FIEMAP isn't supported by $FSTYP.

Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
11 months agofstests: mkfs the scratch device if we have missing profiles
Josef Bacik [Tue, 7 May 2024 20:08:53 +0000 (16:08 -0400)]
fstests: mkfs the scratch device if we have missing profiles

I have a btrfs config where I specifically exclude raid56 testing, and
this resulted in btrfs/011 failing with an inconsistent file system.
This happens because the last test we run does a btrfs device replace of
the $SCRATCH_DEV, leaving it with no valid file system.  We then skip
the remaining profiles and exit, but then we go to check the device on
$SCRATCH_DEV and it fails because there is no file system.

Fix this to re-make the scratch device if we skip any of the raid
profiles.  This only happens in the case of some idiot user configuring
their testing in a special way, in normal runs of this test we'll never
re-make the fs.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
11 months agofstests: btrfs/301: handle auto-removed qgroups
Qu Wenruo [Tue, 7 May 2024 07:06:06 +0000 (16:36 +0930)]
fstests: btrfs/301: handle auto-removed qgroups

There are always attempts to auto-remove empty qgroups after dropping a
subvolume.

For squota mode, not all qgroups can or should be dropped, as there are
common cases where the dropped subvolume are still referred by other
snapshots.
In that case, the numbers can only be freed when the last referencer
got dropped.

The latest kernel attempt would only try to drop empty qgroups for
squota mode.
But even with such safe change, the test case still needs to handle
auto-removed qgroups, by explicitly echoing "0", or later calculation
would break bash grammar.

This patch would add extra handling for such removed qgroups, to be
future proof for qgroup auto-removal behavior change.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>