summaryrefslogtreecommitdiff
path: root/tests/btrfs
AgeCommit message (Collapse)Author
2024-05-24fstests: mkfs the scratch device if we have missing profilesJosef Bacik
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>
2024-05-24fstests: btrfs/301: handle auto-removed qgroupsQu Wenruo
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>
2024-05-24btrfs/{140,141}: verify read-repair test data by md5sumJosef Bacik
For validating that read repair works properly we corrupt one mirror and then read back the physical location after we do a direct or buffered read on the mounted file system and then unmount the file system. The golden output expects all a's, however with encryption this will obviously not be the case. However I still broke read repair, so these tests are quite valuable. Fix them to dump the on disk values to a temporary file and then md5sum the files, and then validate the md5sum to make sure the read repair worked properly. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
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-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-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-28btrfs/290: fix btrfs_corrupt_block optionsAnand Jain
Checks if the running btrfs-corrupt-block also has the options value and offset. Remove btrfs-corrupt-block command's STDOUT and STDERR output redirection to /dev/null. Without this, debugging wasn't possible. I also noticed that command is quiet when successfull, so no redirect to $seqres.full is required. 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: use _btrfs for 'subvolume snapshot' commandQu Wenruo
[BUG] All the touched test cases would fail after btrfs-progs commit 5f87b467a9e7 ("btrfs-progs: subvolume: output the prompt line only when the ioctl succeeded") due to golden output mismatch. [CAUSE] Although the patch I sent to the mail list doesn't change the output at all but only a timing change, David uses this patch to unify the output of "btrfs subvolume create" and "btrfs subvolume snapshot". Unfortunately this changes the output and causes mismatch with golden output. [FIX] Just use the recommended way to run simple btrfs command, _btrfs, for those all "btrfs subvolume snapshot" call sites, and remove the line from golden output. The only case not utilizing `_btrfs` is btrfs/300, which utilize user_do(), which doesn't have the fstests functions. The "_btrfs()" helper has the following advantages: - Save the command line arguments and output into $seqres.full For easier debugging - Check the return value of the btrfs command This would ensure future informative output change would not trigger such situation any more. 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>
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-28btrfs: remove useless commentsDavid Sterba
Remove comments from the new test template that are not relevant once the test case is written: - commented out common.filters (no filters used) - Import common functions. - real QA test starts here - Modify as appropriate. - get standard environment, filters and checks 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-04-28btrfs/125 197 198: cleanup using SCRATCH_DEV_NAMEAnand Jain
Use SCRATCH_DEV_NAME[n] to provide the device path for each device from the scratch device pool. Also, in btrfs/197, remove common/filter since it calls common/filter.btrfs. Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Anand Jain <anand.jain@oracle.com>
2024-04-28fstests: update tests to skip unsupported raid profile typesJosef Bacik
Tests btrfs/197, btrfs/198, and btrfs/297 test multiple raid types in their workout() function. We may not support some of the raid types, so add a check in the workout() function to skip any incompatible raid profiles. 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-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-28fstests: change btrfs/197 and btrfs/198 golden outputJosef Bacik
Both btrfs/197 and btrfs/198 check several raid types. We may not have support for raid5/6 for our available profiles, but we'd like to be able to test the other profiles. In order to enable this, update the golden output to have no output, and simply have the test check for the device we removed to see if it still exists in the device list output. This will allow us to add a check to skip unsupported raid configurations in our config. 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-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/06[0-9]..07[0-4]: kill all background tasks when test is ↵Filipe Manana
killed/interrupted Test cases btrfs/06[0-9] and btrfs/07[0-4] exercise multiple concurrent operations while fsstress is running in parallel, and all these are left as child processes running in the background, which are correctly stopped if the tests are not interrupted/killed. However if any of these tests is interrupted/killed, it often leaves child processes still running in the background, which prevent further running fstests again. For example: $ /check -g auto (...) btrfs/060 394s ... 264s btrfs/061 83s ... 69s btrfs/062 109s ... 105s btrfs/063 52s ... 67s btrfs/064 53s ... 51s btrfs/065 88s ... 271s btrfs/066 127s ... 241s btrfs/067 435s ... 248s btrfs/068 161s ... ^C^C ^C $ ./check btrfs/068 FSTYP -- btrfs PLATFORM -- Linux/x86_64 debian0 6.8.0-rc7-btrfs-next-153+ #1 SMP PREEMPT_DYNAMIC Mon Mar 4 17:19:19 WET 2024 MKFS_OPTIONS -- /dev/sdb MOUNT_OPTIONS -- /dev/sdb /home/fdmanana/btrfs-tests/scratch_1 our local _scratch_mkfs routine ... btrfs-progs v6.6.2 See https://btrfs.readthedocs.io for more information. ERROR: unable to open /dev/sdb: Device or resource busy check: failed to mkfs $SCRATCH_DEV using specified options Interrupted! Passed all 0 tests In this case there was still a process running _btrfs_stress_subvolume() from common/btrfs. This is a bit annoying because it requires manually finding out which process is preventing unmounting the scratch device and then properly stop/kill it. So fix this by adding a _cleanup() function to all these tests and then making sure it stops all the child processes it spawned and are running in the background. All these tests have the same structure as they were part of the same patchset and from the same author. 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: 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/028: removed redundant sync and scratch filesystem unmountFilipe Manana
There's no need to have an explicit scratch filesystem sync and unmount at the of the test, as the fstests framework automatically unmounts the filesystem and the unmount naturally syncs any data and metadata. So remove them and update the comment to be more clear. 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/028: use the helper _btrfs_kill_stress_balance_pidFilipe Manana
Now that there's a helper to kill a background process that is running _btrfs_stress_balance(), use it in btrfs/028. It's equivalent to the existing code in btrfs/028. 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-24fstests: btrfs/195: skip raid setups not in the profile configsJosef Bacik
You can specify a custom BTRFS_PROFILE_CONFIGS to skip certain raid configurations in the tests, however btrfs/195 doesn't honor this currently. Fix this up by getting the profile configs and skipping any configurations that are not listed in BTRFS_PROFILE_CONFIGS. 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-24btrfs/330: add test to validate ro/rw subvol mountingJosef Bacik
Btrfs has had the ability for almost a decade to allow ro and rw mounting of subvols. This behavior specifically mount -o subvol=foo,ro /some/dir mount -o subvol=bar,rw /some/other/dir This seems simple, but because of the limitations of how we did mounting in ye olde days we would mark the super block as RO and the mount if we mounted RO first. In the case above /some/dir would instantiate the super block as read only and the mount point. So the second mount command under the covers would convert the super block to RW, and then allow the mount to continue. The results were still consistent, /some/dir was still read only because the mount was marked read only, but /some/other/dir could be written to. This is a test to make sure we maintain this behavior, as I almost regressed this behavior while converting us to the new mount API. 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> [ Fixed mkfs.btrfs redirect. Removed common/filter. ]
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-20btrfs/316: use rescan wrapperBoris Burkov
btrfs/316 is broken on the squota configuration because it uses a raw rescan call which fails, instead of using the rescan wrapper. The test passes with squota, so run it (instead of requiring rescan) though I suspect it isn't the most meaningful test. 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>
2024-03-20btrfs/277: specify protocol version 3 for verity sendBoris Burkov
This test uses btrfs send with fs-verity which relies on protocol version 3. The default in progs is version 2, so we need to explicitly specify the protocol version. Note that the max protocol version in progs is also currently broken (not properly gated by EXPERIMENTAL) so that needs fixing as well. 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> [ added _require_btrfs_send_version 3 ]
2024-03-20btrfs/320: skip -O squota runsBoris Burkov
This test makes assumptions about the shared usage under snapshots which are not valid when using squotas. Skip squotas for this test. Also, make it use the rescan wrapper, just for uniformity and since it doesn't hurt. 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> [ added _require_qgroup_rescan ]
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-13fstests: add missing commit IDs to some testsv2024.03.17Filipe Manana
Some tests are still using a 'xxx...' commit ID but the respective patches were already merged to Linus' tree or btrfs-progs, so update them with the correct commit IDs and in two cases update the subject as well, because it was modified after the test case was added and before being sent to Linus (btrfs/317 and generic/707). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12btrfs/172,206: call _log_writes_cleanup in _cleanupSu Yue
Because block group tree requires require no-holes feature, _log_writes_mkfs "-O ^no-holes" fails when "-O block-group-tree" is given in MKFS_OPTION. Without explicit _log_writes_cleanup, the two tests fail with logwrites-test device left. And all next tests will fail due to SCRATCH DEVICE EBUSY. Fix it by overriding _cleanup to call _log_writes_cleanup. Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Su Yue <glass.su@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-12fstests: btrfs/121: allow snapshot with invalid qgroup to return errorQu Wenruo
[BUG] After incoming kernel commit "btrfs: qgroup: verify btrfs_qgroup_inherit parameter", test case btrfs/121 would fail like this: btrfs/121 1s ... [failed, exit status 1]- output mismatch (see /xfstests/results//btrfs/121.out.bad) --- tests/btrfs/121.out 2022-05-11 09:55:30.739999997 +0800 +++ /xfstests/results//btrfs/121.out.bad 2024-03-03 13:33:38.076666665 +0800 @@ -1,2 +1,3 @@ QA output created by 121 -Silence is golden +failed: '/usr/bin/btrfs subvolume snapshot -i 1/10 /mnt/scratch /mnt/scratch/snap1' +(see /xfstests/results//btrfs/121.full for details) ... (Run 'diff -u /xfstests/tests/btrfs/121.out /xfstests/results//btrfs/121.out.bad' to see the entire diff) [CAUSE] The incoming kernel commit would do early qgroups validation before subvolume/snapshot creation, and reject invalid qgroups immediately. Meanwhile that test case itself still assume the ioctl would go on without any error, thus the new behavior would break the test case. [FIX] Instead of relying on the snapshot creation ioctl return value, we just completely ignore the output of that snapshot creation. Then manually check if the fs is still read-write. For different kernels (3 cases), they would lead to the following results: - Older unpatched kernel The filesystem would trigger a transaction abort (would be caught by dmesg filter), and also fail the "touch" command. - Older but patched kernel The filesystem continues to create the snapshot, while still keeps the fs read-write. - Latest kernel with qgroup validation The filesystem refuses to create the snapshot, while still keeps the fs read-write. Both "older but patched" and "latest" kernels would still pass the test case, even with different behaviors. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-11btrfs: test normal qgroup operations in a compress friendly wayJosef Bacik
btrfs/022 currently fails if you are testing with -o compress because it does a limit exceed test which will pass with compression on. However the other functionality this test tests is completely acceptable with compression enabled. Handle this by breaking the test into two tests, one that simply tests the qgroup exceed limits test that requires no compression, and the rest of the tests that do not have the no compression restriction. 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-11btrfs/291: remove image file after teardownJosef Bacik
LVM doesn't like it when you remove the file out from underneath the backing device. 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-11btrfs/287,btrfs/293: filter all btrfs subvolume delete callsJosef Bacik
Some of our btrfs subvolume delete calls get put into the golden output, and many of them simply _filter_scratch. This works fine, but we recently changed btrfs subvolume delete output, and it would have been nice to simply filter this in one place. We have a _filter_btrfs_subvol_delete helper, but it's only used in one place. Fix all of these uses to call _filter_btrfs_subvol_delete, this will allow for follow up fixes against _filter_btrfs_subvol_delete itself to deal with changed output. 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-11btrfs/271: adjust failure conditionJosef Bacik
btrfs/271 was failing with the subpage blocksize VM's. This is because there's an assumption made that the device error counters are per-sector, but they're per-io. With a 16kib pagesize and a 4k sectorsize/nodesize the threshold was expecting 16 failed IO's, but instead we were getting 5. This other gotcha here is that with the tree log we will write the log tree first, and then update the log root tree with the location of the log tree root node. With pagesize == nodesize this is fine, we will only write the log tree root node. However with subpage blocksize both of these nodes could be on the same page, and thus they are both written out during that initial write. When we update the pointer for the log root tree we will COW the log root tree root node and submit another IO, resulting in 3 metadata IO's instead of 2. Fix the failure case to be < 4 blocks, which is the minimum number of IO's we should be seeing. 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-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-11btrfs/131: don't run with subpage blocksizesJosef Bacik
This test requires a feature that is incompatible with subpage blocksizes. Check to see if that's what we're testing and simply skip this test. 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-11btrfs/012: adjust how we populate the fs to convertJosef Bacik
/lib/modules/$(uname -r)/ can have symlinks to the source tree where the kernel was built from, which can have all sorts of stuff, which will make the runtime for this test exceedingly long. We're just trying to copy some data into our tree to test with, we don't need the entire devel tree of whatever we're doing. Additionally VM's that aren't built with modules will fail this test. Update the test to use /etc, which will always exist. Additionally use timeout just in case there's large files or some other shenanigans so the test doesn't run forever copying large amounts of files. 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> [ fix use $TIMEOUT_PROG ]
2024-03-11btrfs/011: increase the runtime for replace cancelJosef Bacik
This test exercises the btrfs replace cancel path, but in order to do this we have to have enough work to do in order to successfully cancel the balance, otherwise the test fails because the operation has completed before we're able to cancel. This test has a very low pass rate because we do not generate a large enough file system for replace to have enough work, passing around 5% of the time. Increase the time spent to 10x the time we wait for the replace to start its work before we cancel, this allows us to consistently pass this test. 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-01btrfs/016: fix a false alert due to xattrs mismatchv2024.03.03Qu Wenruo
[BUG] When running btrfs/016 after any other test case, it would fail on a SELinux enabled environment: btrfs/015 1s ... 0s btrfs/016 1s ... [failed, exit status 1]- output mismatch (see ~/xfstests-dev/results//btrfs/016.out.bad) --- tests/btrfs/016.out 2023-12-28 10:39:36.481027970 +1030 +++ ~/xfstests-dev/results//btrfs/016.out.bad 2023-12-28 15:53:10.745436664 +1030 @@ -1,2 +1,3 @@ QA output created by 016 -Silence is golden +fssum failed +(see ~/xfstests-dev/results//btrfs/016.full for details) ... (Run 'diff -u ~/xfstests-dev/tests/btrfs/016.out ~/xfstests-dev/results//btrfs/016.out.bad' to see the entire diff) Ran: btrfs/015 btrfs/016 Failures: btrfs/016 Failed 1 of 2 tests [CAUSE] The test case itself would try to use a blank SELinux context for the SCRATCH_MNT, to control the xattrs. But the initial send stream is generated from $TEST_DIR, which may still have the default SELinux mount context. And such mismatch in the SELinux xattr (source on $TEST_DIR still has the extra xattr, meanwhile the receve end on $SCRATCH_MNT doesn't) would lead to above mismatch. [FIX] Fix the false alerts by disable XATTR checks. Furthermore instead of doing all the edge juggling using $TEST_DIR, this time we do all the work on $SCRATCH_MNT. This means we would generate the initial send stream from $SCRATCH_MNT, then reformat the fs, mount scratch again, receive and verify. We no longer needs to cleanup the extra file for the initial send stream, as they are on the scratch device and would be formatted anyway. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01tests/*/Makefile: make sure group.list DIRT exists before installMartin Jansa
* sometimes make install was failing with: cp: cannot stat 'group.list': No such file or directory and bunch of non-fatal messages:   mv: failed to preserve ownership for 'group.list': Invalid argument * this was when tools/mkgroupfile did mv -f "$new_groups" "$groupfile" overwritting the group.list file while install-sh was already copying it to output * in the end easily reproducible by 1) removing tests/*/group.list before each make install 2) adding some sleep in mkgroupfile before the mv call Signed-off-by: Martin Jansa <martin.jansa@gmail.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01btrfs: require no nodatacow for tests that exercise read repairFilipe Manana
Several test cases that exercise the ability to detect corrupted data and repair it, fail when "-o nodatacow" is passed to MOUNT_OPTIONS, because that ability requires the existence of data checksums, and those are disabled in nodatacow mode. So skip the tests when "-o nodatacow" is present. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01btrfs/299: skip test if we were mounted with nodatacowFilipe Manana
The test requires the ability to create an inline extent in a file with a prealloced extent, created with fallocate's FALLOC_FL_KEEP_SIZE mode, which can only happen when COW is enabled. If the test is run with MOUNT_OPTIONS="-o nodatacow", then COW never happens as all writes end up using the preallocated extent. This results in the logical-resolve command to return one file path when it should return none, since the base logical address of the prealloc extent is still in use unless COW happens. So make the test not run if nodatacow is specified in MOUNT_OPTIONS. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01btrfs/173: make the test work when mounting with nodatacowFilipe Manana
Currently btrfs/173 fails when passing "-o nodatacow" to MOUNT_OPTIONS because it assumes that when creating a file it does not have the nodatacow flag set, which is obviously not true if the fs is mounted with "-o nodatacow". To allow the test to run successfully with nodatacow, just make sure it clears the nodatacow flag from the file if the fs was mounted with "-o nodatacow". Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2024-03-01btrfs: require no nodatacow for tests that exercise compressionFilipe Manana
Several test cases fail when running with MOUNT_OPTIONS="-o nodatacow" because they attempt to use compression and compression can not be enabled on nodatacow files (it fails with -EINVAL). So make sure those tests are not run if nodatacow is specified in MOUNT_OPTIONS. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>