summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2023-12-24fstests: filter.btrfs: update _filter_transaction_commit()Naohiro Aota
Recent btrfs-progs commit 5c91264d2dfc ("btrfs-progs: subvol delete: print the id of the deleted subvolume") added the id of the deleted subvolume to "Delete subvolume" print format. As a result, btrfs/001 now always fail by the output difference. - output mismatch (see /host/results/btrfs/001.out.bad) --- tests/btrfs/001.out 2021-02-05 01:44:17.000000000 +0000 +++ /host/results/btrfs/001.out.bad 2023-12-15 01:43:07.000000000 +0000 @@ -33,7 +33,7 @@ Listing subvolumes snap subvol -Delete subvolume 'SCRATCH_MNT/snap' +Delete subvolume 256 (no-commit): 'SCRATCH_MNT/snap' List root dir subvol ... Fix the issue by updating _filter_transaction_commit(). Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-12-24_require_sparse_files: rewrite as a direct test instead of a black listAlexander Patrakov
_require_sparse_files was implemented as a list of filesystems known not to support sparse files, and therefore it missed some cases. However, if sparse files do not work as expected during a test, the risk is that the test will write out to the disk all the zeros that would normally be unwritten. This amounts to at least 4 TB for the generic/129 test, and therefore there is a significant media wear-out concern here. Adding more filesystems to the list of exclusions would not scale and would not work anyway because CIFS backed by SAMBA is safe, while CIFS backed by Windows Server 2022 is not (because the specific write patterns found in generic/014 and generic/129 cause it to ignore the otherwise-supported request to make a file sparse). Mitigate this risk by rewriting the check as a small-scale test that reliably triggers Windows misbehavior. The black list becomes unneeded because the same test creates and detects non-sparse files on exfat and hfsplus. Signed-off-by: Alexander Patrakov <patrakov@gmail.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-12-16overlay: prepare for new lowerdir+,datadir+ testsAmir Goldstein
In preparation to forking tests for new lowerdir+,datadir+ mount options, prepare a helper to test kernel support and pass datadirs into mount helpers in overlay/079 test. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-12-09overlay/026: Fix test expectation for newer kernelsAlexander Larsson
The test checks the expectaion from old kernels that set/get of trusted.overlay.* xattrs is not supported on an overlayfs filesystem. New kernels support set/get xattr of trusted.overlay.* xattrs, so adapt the test to check that either both set and get work on new kernel, or neither work on old kernel. Signed-off-by: Alexander Larsson <alexl@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-17misc: update xfs_io swapext usageDarrick J. Wong
Since the new 'exchange range' functionality is no longer a VFS level concept, the xfs_io swapext -v options have changed. Update fstests to reflect this new reality. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-16xfs: test unlinked inode list repair on demandDarrick J. Wong
Create a test to exercise recovery of unlinked inodes on a clean filesystem. This was definitely possible on old kernels that on an ro mount would clean the log without processing the iunlink list. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-16common: make helpers for ttyprintk usageDarrick J. Wong
A handful of tests write things to /dev/ttyprintk to make it easier to pinpoint where in a test something went wrong. This isn't entirely robust, however, because ttyprintk is an optional feature. In the grand tradition of kernel design there's also a /dev/kmsg that does nearly the same thing, is also optional, and there's no documentation spelling out when one is supposed to use one or the other. So. Create a pair of helpers to append messages to the kernel log. One simply writes its arguments to the kernel log, and the other writes stdin to the kernel log, stdout, and any other files specified as arguments. Underneath the covers, both functions will send the message to /dev/ttyprintk if available. If it isn't but /dev/kmsg is, they'll send the messages there, prepending a "[U]" to emulate the only discernable difference between ttyprintk and kmsg. If neither are available, then either /dev or the kernel aren't allowing us to write to the kernel log, and the messages are not logged. The second helper will still write the messages to stdout. If this seems like overengineered nonsense, then yes it is. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-16common/btrfs: add _btrfs_get_fsid() helperAnand Jain
We have two instances of reading the btrfs fsid by using the command 'btrfs filesystem show <mnt>' turn this into an easy-to-use helper function and also use it. Suggested-by: David Sterba <dsterba@suse.cz> Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-16common/btrfs: add helper _has_btrfs_sysfs_feature_attrAnand Jain
With this helper, btrfs test cases can now check if a particular feature is implemented in the kernel. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-11-16common/rc: _fs_sysfs_dname fetch fsid using btrfs toolAnand Jain
Currently _fs_sysfs_dname gets fsid from the findmnt command however this command provides the metadata_uuid if the device is mounted with temp-fsid. So instead, use btrfs filesystem show command to know the fsid. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05common/rc: check error case and fail the testNaohiro Aota
If we place /var/lib/xfstests on a read-only filesystem, commands in _link_out_file_named() fail to modify the files. However, they won't fail the test. As a result, the test case fails mysteriously with only "no qualified output" printed. Fix it by checking the error case. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05btrfs/300: check existence of unshare argumentsDarrick J. Wong
Make sure the installed unshare binary supports all the arguments that it wants to use. The unshare program on my system (Ubuntu 22.04) doesn't support --map-auto, so this test fails unnecessarily. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05_scratch_mkfs_geom: Fix regex used for matching block size optionChandan Babu R
The regular expression used by _scratch_mkfs_geom() to match mkfs.xfs' block size argument interprets the character 'b' as optional. It should actually interpret whitespace as optional. This causes generic/223 to fail when testing an XFS filesystem which uses an external log device along with the -lsize option. In this case, the original value of -lsize is replaced with the value of $blocksize. _scratch_mkfs_sized() also uses the same incorrect regex. Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05btrfs: quota rescan helpersBoris Burkov
Many btrfs tests explicitly trigger quota rescan. This is not a meaningful operation for simple quotas, so we wrap it in a helper that doesn't blow up quite so badly and lets us run those tests where the rescan is a qgroup detail. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05btrfs: quota mode helpersBoris Burkov
To facilitate skipping tests depending on the qgroup mode after mkfs, add support for figuring out the mode. This cannot just rely on the new sysfs file, since it might not be present on older kernels. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-10-05common: refactor sysfs_attr functionsBoris Burkov
Expand the has/get/require functions to allow passing a dev by parameter, and implement the test_dev specific one in terms of the new generic one. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-23btrfs: use full subcommand name at _btrfs_get_subvolid()Filipe Manana
Avoid using the shortcut "sub" for the "subvolume" command, as this is the standard practice because such shortcuts are not guaranteed to exist in every btrfs-progs release (they may come and go). Also make the variables local. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-20common/rc: make _get_max_file_size find file size on mount pointAndrey Albershteyn
Currently, _get_max_file_size finds max file size on $TEST_DIR. The tests/generic/692 uses this function to detect file size and then tries to create a file on $SCRATCH_MNT. This works fine when test and scratch filesystems have the same block size. However, it will fail if they differ. Make _get_max_file_size accept mount point on which to detect max file size. Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-16fstests: use btrfs check repair for repairing btrfs filesystemsAnand Jain
There are two repair functions: _repair_scratch_fs() and _repair_test_fs(). As the names suggest, these functions are designed to repair the filesystems SCRATCH_DEV and TEST_DEV, respectively. However, these functions never called proper comamnd for the filesystem type btrfs. This patch fixes it. Thx. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-02common: rename get_page_size to _get_page_sizeDarrick J. Wong
This function does not follow the naming convention that common helpers must start with an underscore. Fix this. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-02common: split _get_hugepagesize into detection and actual queryDarrick J. Wong
This helper has two parts -- querying the value, and _notrun'ing the test if huge pages aren't turned on. Break these into the usual _require_hugepages and _get_hugepagesize predicates so that we can adapt xfs/559 to large folios being used for writes. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-09-02common/attr: fix the _require_acl testJeff Layton
_require_acl tests whether you're able to fetch the ACL from a file using chacl, and then tests for an -EOPNOTSUPP error return. Unfortunately, filesystems that don't support them (like NFSv4) just return -ENODATA when someone calls getxattr for the POSIX ACL, so the test doesn't work. Fix the test to have chacl set an ACL on the file instead, which should reliably fail on filesystems that don't support them. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-08-25common/rc: introduce _random_file() helperNaohiro Aota
Currently, we use "ls ... | sort -R | head -n1" (or tail) to choose a random file in a directory.It sorts the files with "ls", sort it randomly and pick the first line, which wastes the "ls" sort. Also, using "sort -R | head -n1" is inefficient. For example, in a directory with 1000000 files, it takes more than 15 seconds to pick a file. $ time bash -c "ls -U | sort -R | head -n 1 >/dev/null" bash -c "ls -U | sort -R | head -n 1 >/dev/null" 15.38s user 0.14s system 99% cpu 15.536 total $ time bash -c "ls -U | shuf -n 1 >/dev/null" bash -c "ls -U | shuf -n 1 >/dev/null" 0.30s user 0.12s system 138% cpu 0.306 total So, we should just use "ls -U" and "shuf -n 1" to choose a random file. Introduce _random_file() helper to do it properly. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-08-19fstests: Verify dir permissions when creating a stub subvolumeLee Trager
btrfs supports creating nesting subvolumes however snapshots are not recurive. When a snapshot is taken of a volume which contains a subvolume the subvolume is replaced with a stub subvolume which has the same name and uses inode number 2. This test validates that the stub volume copies permissions of the original volume. Signed-off-by: Lee Trager <lee@trager.us> Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-08-19common/rc: drop 'fsck -f' parameter from _repair_test_fsDavid Disseldorp
The '-f' parameter is fsck.ext# specific, where it's documented to: Force checking even if filesystem is marked clean _repair_test_fs() is only called on _check_test_fs() failure, so dropping the parameter should be possible without changing ext# behaviour. Doing so fixes _repair_test_fs() on exfat, where fsck.exfat doesn't support '-f'. Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-08-05fstests: add helper to canonicalize devices used to enable persistent disksLuis Chamberlain
The filesystem configuration file does not allow you to use symlinks to real devices given the existing sanity checks verify that the target end device matches the source. Device mapper links work but not symlinks for real drives do not. Using a symlink is desirable if you want to enable persistent tests across reboots. For example you may want to use /dev/disk/by-id/nvme-eui.* so to ensure that the same drives are used even after reboot. This is very useful if you are testing for example with a virtualized environment and are using PCIe passthrough with other qemu NVMe drives with one or many NVMe drives. To enable support just add a helper to canonicalize devices prior to running the tests. This allows one test runner, kdevops, which I just extended with support to use real NVMe drives it has support now to use nvme EUI symlinks and fallbacks to nvme model + serial symlinks as not all NVMe drives support EUIs. The drives it uses for the filesystem configuration optionally is with NVMe eui symlinks so to allow the same drives to be used over reboots. For instance this works today with real nvme drives: mkfs.xfs -f /dev/nvme0n1 mount /dev/nvme0n1 /mnt TEST_DIR=/mnt TEST_DEV=/dev/nvme0n1 FSTYP=xfs ./check generic/110 FSTYP -- xfs (debug) PLATFORM -- Linux/x86_64 flax-mtr01 6.5.0-rc3-djwx #rc3 SMP PREEMPT_DYNAMIC Wed Jul 26 14:26:48 PDT 2023 generic/110 2s Ran: generic/110 Passed all 1 tests But this does not: TEST_DIR=/mnt TEST_DEV=/dev/disk/by-id/nvme-eui.0035385411904c1e FSTYP=xfs ./check generic/110 mount: /mnt: /dev/disk/by-id/nvme-eui.0035385411904c1e already mounted on /mnt. common/rc: retrying test device mount with external set mount: /mnt: /dev/disk/by-id/nvme-eui.0035385411904c1e already mounted on /mnt. common/rc: could not mount /dev/disk/by-id/nvme-eui.0035385411904c1e on /mnt umount /mnt TEST_DIR=/mnt TEST_DEV=/dev/disk/by-id/nvme-eui.0035385411904c1e FSTYP=xfs ./check generic/110 TEST_DEV=/dev/disk/by-id/nvme-eui.0035385411904c1e is mounted but not on TEST_DIR=/mnt - aborting Already mounted result: /dev/disk/by-id/nvme-eui.0035385411904c1e /mnt This fixes this. This allows the same real drives for a test to be used over and over after reboots. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-08-05check: generate gcov code coverage reports at the end of each sectionDarrick J. Wong
Support collecting kernel code coverage information as reported in debugfs. At the start of each section, we reset the gcov counters; during the section wrapup, we'll collect the kernel gcov data. If lcov is installed and the kernel source code is available, it will also generate a nice html report. If a CLI web browser is available, it will also format the html report into text for easy grepping. This requires the test runner to set REPORT_GCOV=1 explicitly and gcov to be enabled in the kernel. Cc: tytso@mit.edu Cc: kent.overstreet@linux.dev Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-23common/rc: cleanup old .kmemleak filesLuís Henriques
I've spent a non-negligible amount of time looking into a kmemleak that didn't exist in the code I was testing because there was an old .kmemleak file in the results directory. I don't think this is an intended behaviour, so I'm proposing to remove these files everytime we capture the result of a new scan. Signed-off-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-23overlay: Add test coverage for fs-verity supportAlexander Larsson
This tests that the right xattrs are set during copy-up, and that we properly fail on missing of erronous fs-verity digests when validating. We also ensure that verity=require fails if a metacopy has not fs-verity, and doesn't do a meta-coopy-up if the base file lacks verity. Signed-off-by: Alexander Larsson <alexl@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-23overlay: Add test for follow of lowerdata in data-only layersAmir Goldstein
Add test coverage for following metacopy from lower layer to data-only lower layers. Data-only lower layers are configured using the syntax: lowerdir=<lowerdir1>:<lowerdir2>::<lowerdata1>::<lowerdata2>. Test that lowerdata files can be followed only by absolute redirect from lower layer. Test that with two lowerdata dirs, we can lookup individual lowerdata files in both, and that a shared file is resolved from the uppermost lowerdata dir. There is also test case for lazy-data lookups, where we remove the lowerdata file and validate that we get metadata from the metacopy file, but open fails. Signed-off-by: Alexander Larsson <alexl@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-23overlay: add helper for mounting rdonly overlayAmir Goldstein
Allow passing empty upperdir to _overlay_mount_dirs(). Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Alexander Larsson <alexl@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-09report: remove xmlns specifierv2023.07.09Theodore Ts'o
By specifying "xmlns=https://git.kernel.org/.../xfstests-dev.git", this causes XML complaint parsers, such as the one used by the python junitparser library, to put all of the XML elements into a namespace, which then causes junitparser to toss its cookies. This can be worked-around in a test runner script via: sed -i.orig -e 's/xmlns=\".*\"//' "$RESULT_BASE/result.xml" but it's better not to include the xmlns line at all in the first place, since this may cause other users of fstests who are using the Python junitparser library a lot of headaches. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-09report: safely update the result.xml fileTheodore Ts'o
After every single test, we rewrite result.xml from scratch. This ensures that the XML file is always in a valid, parseable state, even if the check script is killed or the machine crashes in the middle of a test. If the test is being run in a Cloud VM as a "spot" (Amazon, Azure, or GCE) or "preemptible" (Oracle) instance, the VM can be halted whenever the Cloud provider needs the capacity for customers who are willing to pay full price. ("Spot" instances can be 60% to 90% cheaper --- allowing the frugal kernel developer to get up to 10 times more testing for the same amount of money. :-) Since a "spot" VM can get terminated at any time, it is possible for the check script to be killed while it is in the middle of rewriting the result.xml file. If the result.xml file is only partially written, information regarding the tests run before VM termination will be lost. To address this race, write the new result.xml file as result.xml.new, and only rename it to result.xml after the XML file is fully written out. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-07-07common/btrfs: handle dmdust as mounted device in ↵Qu Wenruo
_btrfs_buffered_read_on_mirror() [BUG] After commit ab41f0bddb73 ("common/btrfs: use _scratch_cycle_mount to ensure all page caches are dropped"), the test case btrfs/143 can fail like below: btrfs/143 6s ... [failed, exit status 1]- output mismatch (see ~/xfstests/results//btrfs/143.out.bad) --- tests/btrfs/143.out 2020-06-10 19:29:03.818519162 +0100 +++ ~/xfstests/results//btrfs/143.out.bad 2023-06-19 17:04:00.575033899 +0100 @@ -1,37 +1,6 @@ QA output created by 143 wrote 131072/131072 bytes XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -XXXXXXXX: aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ -XXXXXXXX: aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ -XXXXXXXX: aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ -XXXXXXXX: aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ [CAUSE] Test case btrfs/143 uses dm-dust device to emulate read errors, this means we can not use _scratch_cycle_mount to cycle mount $SCRATCH_MNT. As it would go mount $SCRATCH_DEV, not the dm-dust device to $SCRATCH_MNT. This prevents us to trigger read-repair (since no error would be hit) thus fail the test. [FIX] Since we can mount whatever device at $SCRATCH_MNT, we can not use _scratch_cycle_mount in this case. Instead implement a small helper to grab the mounted device and its mount options, and use the same device and mount options to cycle $SCRATCH_MNT mount. This would fix btrfs/143 and hopefully future test cases which use dm devices. Reported-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-28common/config: redirect modprobe helpinfo to stdout for busyboxStas Sergeev
Due to the busybox' modprobe writes help to stderr. We need to redirect it to stdout, or it will end up in a test results. Signed-off-by: Stas Sergeev <stsp2@yandex.ru> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-18common/rc: Enable _test_mkfs to force a mkfs on a xfs filesystemv2023.06.18Carlos Maiolino
Calling _test_mkfs on an already initialized xfs FS will fail as the initialization is not enforced by '-f' argument, unless it's included in MKFS_OPTIONS. So, adding 'RECREATE_TEST_DEV=true' to the config file end up being useless for xfs filesystems. So, adding the a specific xfs optiong in _test_mkfs using -f argument makes RECREATE_TEST_DEV actually useful. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-18common/rc: skip ceph-fuse when atime is requiredXiubo Li
Ceph won't maintain the atime, so just skip the tests when the atime is required. Fixes: https://tracker.ceph.com/issues/61551 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-18common/btrfs: use _scratch_cycle_mount to ensure all page caches are droppedQu Wenruo
[BUG] There is a chance that btrfs/266 would fail on aarch64 with 64K page size. (No matter if it's 4K sector size or 64K sector size) The failure indicates that one or more mirrors are not properly fixed. [CAUSE] I have added some trace events into the btrfs IO paths, including __btrfs_submit_bio() and __end_bio_extent_readpage(). When the test failed, the trace looks like this: 112819.764977: __btrfs_submit_bio: r/i=5/257 fileoff=0 mirror=1 len=196608 pid=33663 ^^^ Initial read on the full 192K file 112819.766604: __btrfs_submit_bio: r/i=5/257 fileoff=0 mirror=2 len=65536 pid=21806 ^^^ Repair on the first 64K block Which would success 112819.766760: __btrfs_submit_bio: r/i=5/257 fileoff=65536 mirror=2 len=65536 pid=21806 ^^^ Repair on the second 64K block Which would fail 112819.767625: __btrfs_submit_bio: r/i=5/257 fileoff=65536 mirror=3 len=65536 pid=21806 ^^^ Repair on the third 64K block Which would success 112819.770999: end_bio_extent_readpage: read finished, r/i=5/257 fileoff=0 len=196608 mirror=1 status=0 ^^^ The repair succeeded, the full 192K read finished. 112819.864851: __btrfs_submit_bio: r/i=5/257 fileoff=0 mirror=3 len=196608 pid=33665 112819.874854: __btrfs_submit_bio: r/i=5/257 fileoff=0 mirror=1 len=65536 pid=31369 112819.875029: __btrfs_submit_bio: r/i=5/257 fileoff=131072 mirror=1 len=65536 pid=31369 112819.876926: end_bio_extent_readpage: read finished, r/i=5/257 fileoff=0 len=196608 mirror=3 status=0 But above read only happen for mirror 1 and mirror 3, mirror 2 is not involved. This means by somehow, the read on mirror 2 didn't happen, mostly due to something wrong during the drop_caches call. It may be an async operation or some hardware specific behavior. On the other hand, for test cases doing the same operation but utilizing direct IO, aka btrfs/267, it never fails as we never populate the page cache thus would always read from the disk. [WORKAROUND] The root cause is in the "echo 3 > drop_caches", which I'm still debugging. But at the same time, we can workaround the problem by forcing a cycle mount of scratch device, inside _btrfs_buffered_read_on_mirror(). By this we can ensure all page caches are dropped no matter if drop_caches is working correctly. With this patch, I no longer hit the failure on aarch64 with 64K page size anymore, while before this the test case would always fail during a -I 10 run. [zlang: remove the duplicated drop_caches line] Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Christoph Hellwig <hch@infradead.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-10common/xfs: compress online repair rebuild output by defaultDarrick J. Wong
Force-repairing the filesystem after a test can fill up /tmp with quite a lot of logging message. We don't have a better place to stash that output in case the scrub fails and we need to analyze it later, so compress it with gzip and only decompress it later. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-06-10fuzzy: disallow post-test online rebuilds when testing online fsckDarrick J. Wong
If we're testing the online fsck code or running fuzz tests of the filesystem, don't let the post-test checks rebuild the filesystem metadata, because this is redundant with the test and will disturb the metadata if the tools fail. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-28fuzzy: skip online scrub and health checks if not supportedv2023.05.28Anthony Iliopoulos
Commit a27e6e6f4c18 introduced xfs health checking on no-repair fuzz, which in turn requires scrub to be run before that. The health checks are done only if scrub returns with an error (which is expected as an indication that fuzzed metadata errors were picked up), but the code does not discern between xfs_scrub returning an error because of uncorrected metadata vs failing because the kernel does not support scrub at all. This causes all tests that do fuzzing with no-repair strategy to fail on kernels compiled without online scrub support (CONFIG_XFS_ONLINE_SCRUB). Skip scrub and health checks altogether, if the kernel does not support it, since the tests are still valuable. Fixes: a27e6e6f4c18 ("common: check xfs health after doing an online scrub") Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-28common/{filter,quota}, xfs/1{06,52}: fix grep patternMurphy Zhou
Newer(3.9) grep is complaining about these unnecessary backslashes before # and -, and breaking the golden output. Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-12btrfs: add a test case for the logical to ino ioctlFilipe Manana
Add a test case to exercise the logical to ino ioctl, including the v2 version (which adds the ignore offset option). This is motivated by the fact that we have no test cases giving full coverage to that ioctl, only two test cases partially exercise it (btrfs/004 and btrfs/299) and absolutely no coverage for the v2 ioctl. This resulted in a recent regression fixed by the patch mentioned in the _fixed_by_kernel_commit tag of the introduced test case. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-12common/btrfs: add helper to get the bytenr for a file extent itemFilipe Manana
In upcoming changes there will be the need to find out the logical disk address (bytenr) that a particular file extent item points to. This is already implemented as local functions in the test btrfs/299, which is a bit limited but works fine for that test. Some important or subtle details why it works for this test: 1) It dumps all trees of the filesystem; 2) It relies on fsync'ing a file and then finding the desired file extent item in the log tree from the dump; 3) There's a single subvolume, so it always finds the correct file extent item. In case there were multiple subvolumes, it could pick the wrong file extent item in case we have inodes with the same number on multiple subvolumes (inode numbers are unique only within a subvolume, they are not unique across an entire filesystem). So add a helper to get the bytenr associated to a file extent item to common/btrfs and use it at btrfs/299 and the upcoming changes. This helper will dump only the tree of the default subvolume, will sync the filesystem to commit any open transaction and works only in case the filesystem is using the scratch device. This is explicitly documented. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01misc: add duration for recovery loop testsv2023.05.01Darrick J. Wong
Make it so that we can run recovery loop tests for an exact number of seconds. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01misc: add duration for long soak testsDarrick J. Wong
Make it so that test runners can schedule long soak stress test programs for an exact number of seconds by setting the SOAK_DURATION config variable. Change the definition of the 'soak' test to specify that these tests can be controlled via SOAK_DURATION. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01fstests: Doc changes for afsDavid Howells
Documentation changes for afs. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-afs@lists.infradead.org Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01generic/123, generic/128, afs: Allow for an fs that does its own perm managementDavid Howells
The AFS filesystem has its own distributed permission management system that's based on a per-cell user and group database used in conjunction with ACLs. The user is determined by the authentication token acquired from the kaserver or Kerberos, not by the local fsuid/fsgid. For the most part, the uid, gid and mask on a file are ignored. The generic/123 and generic/128 tests check that the UNIX permission bits do what would normally be expected of them - but this fails on AFS. Using "su" to change the user is not effective on AFS. Instead, "keyctl session" would need to be used and an alternative authentication token would need to be obtained. Provide a "_require_unix_perm_checking" clause so that these tests can be suppressed in cases such as AFS. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01generic/317, afs: Allow for a filesystem not to honour the local uid/gidDavid Howells
Each AFS cell has it's own set of user IDs that is uses internally, in its ACL system and in its protection management protocol. The user ID used by the fileserver is selected from the set belonging to the fileserver's cell according to the authentication token associated with an RPC operation - and this is set as a file's user ID when it is created. This means that tests that expect to set a UID and see the same UID still set afterwards will fail. Add a "_require_use_local_uidgid" clause to indicate that a test expects internal UID/GID information to be seen in the stat output and should be skipped if AFS's case. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-afs@lists.infradead.org Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
2023-05-01generic/314, afs: Allow for a filesystem that doesn't honour SGID inheritanceDavid Howells
The AFS filesystem doesn't do any special handling for the SUID, SGID and SVTX bits and doesn't perform any sort of propagation. Further, only a user with cell admin rights can set non-0777 bits. Handle this by adding a "_require_sgid_inheritance" clause and labelling the test with it, thereby skipping for filesystems that don't support it. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> cc: linux-afs@lists.infradead.org Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>