summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2025-04-26generic/556: support bcachefsHEADmasterKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-11Ensure fuse filesystems unmount correctlyKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-07fuzzy: test other dquot idsDarrick J. Wong
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-06-07fuzzy: allow FUZZ_REWRITE_DURATION to control fsstress runtime when fuzzingDarrick J. Wong
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>
2024-06-07fuzzy: mask off a few more inode fields from the fuzz testsDarrick J. Wong
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>
2024-06-07btrfs: fix raid-stripe-tree tests with non-experimental btrfs-progs buildFilipe Manana
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>
2024-05-25Remove richacl supportv2024.05.26David Sterba
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>
2024-05-25_test_mkfs: Include external log device (if any) when creating fs on TEST_DEVChandan Babu R
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>
2024-05-12common/tracing: use /sys/kernel/tracing at firstZorro Lang
To avoid the dependence of debugfs, tracefs is mounted on another place -- /sys/kernel/tracing now. But for the compatibility, the /sys/kernel/debug/tracing is still there. So change _require_ftrace helper, try to use the new /sys/kernel/tracing path at first, or fallback to the old one if it's not supported. xfs/499 uses ftrace, so call _require_ftrace in it. Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-05-12fstests: fix _require_debugfs and call it properlyZorro Lang
The old _require_debugfs helper doesn't work now, fix it to check a system supports debugfs. And then call this helper in cases which need $DEBUGFS_MNT. Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-05-12xfs/077: remove _require_meta_uuidChristoph Hellwig
_require_meta_uuid tries to check if the configuration supports the metauuid feature. It assumes a scratch fs has already been created, which in the part was accidentally true to do a _require_xfs_crc call that was removed in commit 39afc0aa237d ("xfs: remove support for tools and kernels without v5 support"). As v5 file systems always support meta uuids, and xfs/077 forces a v5 file systems we can just remove the check. Reported-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Chandan Babu R <chandanbabu@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-05-12tests: _fail on _scratch_mkfs_sized failureDavid Disseldorp
If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the provided size, tests may subsequently mount and run atop a previously created (e.g. non-size-bound) filesystem. This can lead to difficult to debug failures, or for some -ENOSPC exercising tests, near infinite runtimes. Avoid this by renaming the current function to _try_scratch_mkfs_sized() and _fail in the parent _scratch_mkfs_sized() wrapper. [zlang: change _fail output, remove missed _fail in b/007, fix g/466] Suggested-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-28common/config: export TEST_DEV for mkfs.xfsv2024.04.28David Disseldorp
As of xfsprogs commit 6e0ed3d1 ("mkfs: stop allowing tiny filesystems") attempts to create XFS filesystems sized under 300M fail, unless TEST_DIR, TEST_DEV and QA_CHECK_FS environment variables are exported (or a --unsupported mkfs parameter is provided). TEST_DIR and QA_CHECK_FS are already exported, while TEST_DEV may only be locally set if provided via e.g. configs/$HOSTNAME.config. Explicitly export TEST_DEV to ensure that tests which call _scratch_mkfs_sized() with an fssize under 300M run normally. Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-28generic: move btrfs clone device testcase to the generic groupAnand Jain
Given that ext4 also allows mounting of a cloned filesystem, the btrfs test case btrfs/312, which assesses the functionality of cloned filesystem support, can be refactored to be under the generic group. So add _require_duplicated_fsid helper, then move btrfs/312 to generic. [zlang: remove "quick" group, change the cleanup of g/744 a bit] Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-28common/verity: fix btrfs-corrupt-block -v optionAnand Jain
The btrfs-corrupt-block -v has been replaced with --value so fix it. _fsv_scratch_corrupt_merkle_tree() uses the btrfs-corrupt-block --value option, so add the "value" prerequisite in the function _require_fsverity_corruption. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-28common/btrfs: refactor _require_btrfs_corrupt_block to check optionAnand Jain
The -v and -o short options in btrfs-corrupt-block were introduced and replaced with the long options --value and --offset in the same btrfs-progs release 5.19 by the following commits: b2ada0594116 ("btrfs-progs: corrupt-block: corrupt generic item data") 22ffee3c6cf2 ("btrfs-progs: corrupt-block: use only long options for value and offset") We hope that if these commits are backported, they are both backported at the same time. Use only the long options of btrfs-corrupt-block in the test cases. Also, check if btrfs-corrupt-block has the options --value and --offset. [zlang: use -w option for grep, and remove "ret" local value] Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-28fstests: btrfs: rename _run_btrfs_util_prog to _btrfsQu Wenruo
For simple btrfs commands like "btrfs subvolume create", the output is only informative, meanwhile the output format may still change in the future. Normally we already have quite some test cases just redirect the output for null or seqres.full, without knowing we have a better suitable function `_run_btrfs_util_prog()` already. This patch firstly rename the function to a much shorter name `_btrfs`, then move it to the top of `common/btrfs`, and add a comment recommending to use it when possible. The use of `_btrfs` mostly matches the real world usage of btrfs-progs (just "btrfs" command), and no need to do any filtering or redirection, and would be the recommended way for future test cases. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-28fstests: change how we test for supported raid configsJosef Bacik
In btrfs there's a few ways we limit the RAID profiles we'll use. We have the raid56 feature that can be compiled out, zoned devices don't support certain raid configurations, and you can manually set BTRFS_PROFILE_CONFIGS to limit what you're testing. To handle all of these different scenarios in the same way, update _btrfs_get_profile_configs() to check for RAID56 support and remove it if it is not there, and then add _require_btrfs_raid_type and _check_btrfs_raid_type to get all the settings and then check if the requested raid type is available. >From there I've updated all of the existing tests that use _require_btrfs_fs_feature raid56 to use _require_btrfs_raid_type <type> where appropriate. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-28btrfs: new test for devt change between mountsBoris Burkov
It is possible to confuse the btrfs device cache (fs_devices) by starting with a multi-device filesystem, then removing and re-adding a device in a way which changes its dev_t while the filesystem is unmounted. After this procedure, if we remount, then we are in a funny state where struct btrfs_device's "devt" field does not match the bd_dev of the "bdev" field. I would say this is bad enough, as we have violated a pretty clear invariant. But for style points, we can then remove the extra device from the fs, making it a single device fs, which enables the "temp_fsid" feature, which permits multiple separate mounts of different devices with the same fsid. Since btrfs is confused and *thinks* there are different devices (based on device->devt), it allows a second redundant mount of the same device (not a bind mount!). This then allows us to corrupt the original mount by doing stuff to the one that should be a bind mount. Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Boris Burkov <boris@bur.io> Signed-off-by: Anand Jain <anand.jain@oracle.com> [ use _create_loop_device, renamed $MNT $BIND and rm them before mkdir ] Signed-off-by: Zorro Lang <zlang@kernel.org> [ update the commit id of _fixed_by_kernel_commit ]
2024-04-20xfs: don't run tests that require v4 file systems when not supportedChristoph Hellwig
Add a _require_xfs_nocrc helper that checks that we can mkfs and mount a crc=0 file systems before running tests that rely on it to avoid failures on kernels with CONFIG_XFS_SUPPORT_V4 disabled. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-20common/quota: update keywords of quota feature in _require_prjquota() for f2fsChao Yu
Previously, in f2fs, sysfile quota feature has different name: - "quota" in mkfs.f2fs - and "quota_ino" in dump.f2fs Now, it has unified the name to "quota" since commit 92cc5edeb7 ("f2fs-tools: reuse feature_table to clean up print_sb_state()"). It needs to update keywords "quota" in _require_prjquota() for f2fs, Otherwise, quota testcase will fail as below. generic/383 1s ... [not run] quota sysfile not enabled in this device /dev/vdc This patch keeps keywords "quota_ino" in _require_prjquota() to keep compatibility for old f2fs-tools. 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>
2024-04-11remove xfs/096Christoph Hellwig
This test exercises mkfs error handling before strict validation was added and thus is useless for xfsprogs > 4.5. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-11xfs: remove support for tools and kernels without v5 supportChristoph Hellwig
v5 file systems have been the default for more than 10 years. Drop support for non-v5 enabled kernels and xfsprogs. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-04-03common/btrfs: lookup running processes using pgrepAnand Jain
Certain helper functions and the testcase btrfs/132 use the following script to find running processes: while ps aux | grep "balance start" | grep -qv grep; do <> done Instead, using pgrep is more efficient. while pgrep -f "btrfs balance start" > /dev/null; do <> done Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: remove stop file early at _btrfs_stress_subvolumeFilipe Manana
Instead of having every test case that uses _btrfs_stress_subvolume() removing the stop file before calling that function, do the file remove at _btrfs_stress_subvolume(). There's no point in doing it in every single test case. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: add helper to stop background process running _btrfs_stress_subvolumeFilipe Manana
We have this logic to stop a process running _btrfs_stress_subvolume() spread in several test cases: touch $stop_file wait $subvol_pid Add a helper to encapsulate that logic and also remove the stop file after the process terminated as there's no point having it around anymore. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: add helper to kill background process running _btrfs_stress_replaceFilipe Manana
Killing a background process running _btrfs_stress_replace() is not as simple as sending a signal to the process and waiting for it to die. Therefore we have the following logic to terminate such process: kill $pid wait $pid while ps aux | grep "replace start" | grep -qv grep; do sleep 1 done Since this is repeated in several test cases, move this logic to a common helper and use it in all affected test cases. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: add helper to kill background process running ↵Filipe Manana
_btrfs_stress_remount_compress Killing a background process running _btrfs_stress_remount_compress() is not as simple as sending a signal to the process and waiting for it to die. Therefore we have the following logic to terminate such process: kill $pid wait $pid while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do sleep 1 done Since this is repeated in several test cases, move this logic to a common helper and use it in all affected test cases. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> [ Restore 'wait $fsstress_pid' before 'kill $replace_pid' ]
2024-04-03btrfs: add helper to kill background process running _btrfs_stress_defragFilipe Manana
Killing a background process running _btrfs_stress_defrag() is not as simple as sending a signal to the process and waiting for it to die. Therefore we have the following logic to terminate such process: kill $pid wait $pid while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do sleep 1 done Since this is repeated in several test cases, move this logic to a common helper and use it in all affected test cases. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: add helper to kill background process running _btrfs_stress_scrubFilipe Manana
Killing a background process running _btrfs_stress_scrub() is not as simple as sending a signal to the process and waiting for it to die. Therefore we have the following logic to terminate such process: kill $pid wait $pid while ps aux | grep "scrub start" | grep -qv grep; do sleep 1 done Since this is repeated in several test cases, move this logic to a common helper and use it in all affected test cases. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-03btrfs: add helper to kill background process running _btrfs_stress_balanceFilipe Manana
Killing a background process running _btrfs_stress_balance() is not as simple as sending a signal to the process and waiting for it to die. Therefore we have the following logic to terminate such process: kill $pid wait $pid # Wait for the balance operation to finish. while ps aux | grep "balance start" | grep -qv grep; do sleep 1 done Since this is repeated in several test cases, move this logic to a common helper and use it in all affected test cases. This will help to avoid repeating the same code again several times in upcoming changes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-30common/fuzzy: make _scratch_fuzz_modify work for non-xfs filesystemsLuis Henriques (SUSE)
Since commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little harder after repairing") funtion _scratch_fuzz_modify() has become xfs-specific due to the use of some functions that assume this filesytem, namely _xfs_force_bdev() and _xfs_has_feature(). Ensure _scratch_fuzz_modify() works again with other filesystems by using these functions only when testing xfs. Signed-off-by: "Luis Henriques (SUSE)" <luis.henriques@linux.dev> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-27common/rc: fix unknown _xfs_repair_test_fs function nameZorro Lang
Sometimes I hit below errors: ./common/rc: line 1293: _xfs_repair_test_fs: command not found ./common/rc: line 1298: _xfs_repair_test_fs: command not found The _repair_test_fs trys to call _xfs_repair_test_fs(), but there's not that function in fstests. According to commit c7d81cdecbef, it brought in _test_xfs_repair, but called wrong name. So fix it. Fixes: c7d81cdecbef ("check: try to fix the test device if it gets corrupted") Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-24common/rc: use proper temporary file path in _repair_test_fs()David Sterba
The path /tmp.repair would be on the system root that could not be writable, the temporary files are available at $tmp . Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-24btrfs/131,btrfs/172,btrfs/206: add check for block-group-tree feature in btrfsJosef Bacik
A new disk format option will make the no-holes option a requirement, so add a helper to make sure that we aren't creating a fs with BLOCK_GROUP_TREE by default, and skip the tests that require turning off no-holes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-20common/btrfs: introduce _require_btrfs_send_versionAnand Jain
Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and check if the Btrfs kernel supports the v3 stream. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-13misc: fix test that fail formatting with 64k blocksizeDarrick J. Wong
There's a bunch of tests that fail the formatting step when the test run is configured to use XFS with a 64k blocksize. This happens because XFS doesn't really support that combination due to minimum log size constraints. Fix the test to format larger devices in that case. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Co-developed-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12common/rc: notrun if io_uring is disabled by sysctlZorro Lang
If kernel supports io_uring, userspace still can/might disable that supporting by set /proc/sys/kernel/io_uring_disabled=2. Let's notrun if io_uring is disabled by that way. Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12common: dm-error now supports zoned devicesChristoph Hellwig
Since kernel commit a951104333bd ("dm error: Add support for zoned block devices") dm-error fully supports zoned devices. Make use of that to also run error injection tests for zoned device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12xfs: test for premature ENOSPC with large cow delalloc extentsDarrick J. Wong
On a higly fragmented filesystem a Direct IO write can fail with -ENOSPC error even though the filesystem has sufficient number of free blocks. This occurs if the file offset range on which the write operation is being performed has a delalloc extent in the cow fork and this delalloc extent begins much before the Direct IO range. In such a scenario, xfs_reflink_allocate_cow() invokes xfs_bmapi_write() to allocate the blocks mapped by the delalloc extent. The extent thus allocated may not cover the beginning of file offset range on which the Direct IO write was issued. Hence xfs_reflink_allocate_cow() ends up returning -ENOSPC. This test addresses this issue. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12xfs/43[4-6]: make module reloading optionalDarrick J. Wong
These three tests examine two things -- first, can xfs CoW staging extent recovery handle corruptions in the refcount btree gracefully; and second, can we avoid leaking incore inodes and dquots. The only cheap way to check the second condition is to rmmod and modprobe the XFS module, which triggers leak detection when rmmod tears down the caches. Currently, the entire test is _notrun if module reloading doesn't work. Unfortunately, these tests never run for the majority of XFS developers because their testbeds either compile the xfs kernel driver into vmlinux statically or the rootfs is xfs so the module cannot be reloaded. The author's testbed boots from NFS and does not have this limitation. Because we've had repeated instances of CoW recovery regressions not being caught by testing until for-next hits my machine, let's make the module reloading optional in all three tests to improve coverage. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-11btrfs/213: make the test more reliableJosef Bacik
This test will write for 8 seconds and then try to balance, but for some setups 8 seconds may be enough to fill the disk. Instead figure out what half the size of the disk is and write at most that many bytes, or for 8 seconds, whichever comes first. Then use the amount of time it took to do the write to determine how long we should allow the balance to continue before we attempt to cancel it. Additionally the macro is '_notrun' not '_not_run'. With this change this test now does the correct thing on my ARM CI VM. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-11common/rc: specify required device sizeAnand Jain
The current _notrun call states that the scratch device is too small but does not specify the required size. Simply update the _notrun messages. Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-11btrfs: fix grep warning at _require_btrfs_mkfs_uuid_option()Filipe Manana
When running _require_btrfs_mkfs_uuid_option(), some grep versions complain about escaping the dash characters and make the tests that use this function fail like this: btrfs/313 2s - output mismatch (see /root/fstests/results//btrfs_normal/btrfs/313.out.bad) --- tests/btrfs/313.out 2024-03-05 18:48:34.929372495 +0000 +++ /root/fstests/results//btrfs_normal/btrfs/313.out.bad 2024-03-05 20:52:27.745166101 +0000 @@ -1,5 +1,8 @@ QA output created by 313 ---- clone_uuids_verify_tempfsid ---- +grep: warning: stray \ before - +grep: warning: stray \ before - +grep: warning: stray \ before - Mounting original device On disk fsid: FSID ... (Run 'diff -u /root/fstests/tests/btrfs/313.out /root/fstests/results//btrfs_normal/btrfs/313.out.bad' to see the entire diff) btrfs/314 3s - output mismatch (see /root/fstests/results//btrfs_normal/btrfs/314.out.bad) --- tests/btrfs/314.out 2024-03-05 18:48:34.929372495 +0000 +++ /root/fstests/results//btrfs_normal/btrfs/314.out.bad 2024-03-05 20:52:32.880237216 +0000 @@ -1,6 +1,9 @@ QA output created by 314 From non-tempfsid SCRATCH_MNT to tempfsid TEST_DIR/314/tempfsid_mnt +grep: warning: stray \ before - +grep: warning: stray \ before - +grep: warning: stray \ before - wrote 9000/9000 bytes at offset 0 ... So fix this by not escaping anymore the dashes and using the -- separator before the regex pattern parameter. Reviewed-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-01common/config: fix CANON_DEVS=yes when file does not existLuis Chamberlain
CANON_DEVS=yes allows you to use symlinks for devices, so fstests resolves them back to the real backing device. The iteration for resolving the backing device works obviously if you have the file present, but if one was not present there is a parsing error. Fix this parsing error introduced by a0c36009103b8 ("fstests: add helper to canonicalize devices used to enable persistent disks"). Fixes: a0c36009103b8 ("fstests: add helper to canonicalize devices used to enable persistent disks" Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01generic/68[12]: use the dir blocksize for xfs filesystemsAnthony Iliopoulos
The tests are using the filesystem block size for calculating the number of dirents required to fill a 2-block directory. For v4 xfs filesystems formatted with fs blocksize of 512 bytes this is failing, as the tests do not take into account that the directory block size is not always equal to the filesystem block size. As such, the tests never go over quota, and even if they did there is no hard block limit being set (due to 512 / 1024 = 0 calculation in setquota). Use the directory blocksize instead of the filesystem blocksize, when the fstype under test is xfs. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01filter.btrfs: add filter for btrfs device addJohannes Thumshirn
Add a filter for the output of btrfs device add. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-01filter.brtfs: add filter for conversionJohannes Thumshirn
Add a filter for the output of btrfs-balance with a convert argument. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-03-01btrfs: detect regular qgroup for older kernels correctlyQu Wenruo
[BUG] When running an older (vendoer v6.4) kernel, some qgroup test cases would be skipped: btrfs/017 1s ... [not run] not running normal qgroups [CAUSE] With the introduce of simple quota mode, there is a new sysfs interface, /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running qgroup modes. And _qgroup_mode() from `common/btrfs` is using that new interface to detect the mode. Unfortuantely for older kernels without simple quota support, _qgroup_mode() would return "disabled" directly, causing those test case to be skipped. [FIX] Fallback to regular qgroup if that sysfs interface is not accessible, as qgroup is introduced from the very beginning of btrfs, thus the regular qgroup is always supported. 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>
2024-03-01btrfs: introduce helper for creating cloned devices with mkfsAnand Jain
Use newer mkfs.btrfs option to generate two cloned devices, used in test cases. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>