Calling src/<file> without path '$here' may cause the problem that
the file cannot be found.
For example, Running generic/192 with overlayfs(Let ubifs as base
fs) yields the following output:
generic/192 - output mismatch
QA output created by 192
sleep for 5 seconds
test
+./common/rc: line 316: src/t_dir_type: No such file or directory
delta1 is in range
delta2 is in range
...
When the use case fails, the call stack in generic/192 is:
local unknowns=$(src/t_dir_type $dir u | wc -l) common/rc
_supports_filetype common/rc
_overlay_mount common/overlay
_overlay_test_mount common/overlay
_test_mount common/rc
_test_cycle_mount generic/192
Before _test_cycle_mount() being invoked, generic/192 executed 'cd
/' to change work dir from 'xfstests-dev' to '/', so src/t_dir_type
was not found.
[Eryu: some tests run src/<file> as regular user, don't add $here
prefix in such case, as a regular user may have no search permission
on $here]
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
On old kernel, since commit ded188b860 ("xfs: Fix the situation
that mount operation rejects corrupted XFS") running this case got
the mismatched output, as below:
-----------------------------------
+ check fs
+ corrupt image
+ mount image && modify files
-broken: 1
+broken: 0
+ repair fs
+ mount image (2)
------------------------------------
It fails because the broken is always equal to 0 when
_try_scratch_mount succeed. So remove this wrong assignment
operation.
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
NFS v4.2 supports SEEK_DATA and SEEK_HOLE, but earlier versions do
not. As a result, the test exits and runs the cleanup function
without the $BASE_TEST_FILE variable set and the shell expands it to
"rm -f .*", deleting all hidden files in the current directory.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Rename-overwrites over NFS work with a "silly rename" over the
network, so the nlink count stays at 1 instead of dropping to 0.
This is expected behavior for NFS, so we should use a different
golden output file to account for this.
See the NFS faq at: nfs.sourceforge.net/#faq_d2 for more
information about silly renames.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add a test to make sure that we can handle multiple memory mappings to a
physical storage extent shared by multiple files, and that we can handle
the copy on write operation without error. Make sure we can also handle
mappings at different offsets in the page cache.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
The filesystem population code frequently allocates a large file and
punches out every other block ("swiss-cheese files") in an attempt to
cause the creation of a lot of metadata to fill out the btrees. This
pattern, however, has a subtle bug if the writes to the swiss-cheese
file are not allocated in batches and we're trying to fragment the free
space records in order to achieve a certain metadata btree shape.
This is exactly what happens on a DAX filesystem, since we no longer
have the page cache to stage delalloc writes. Each xfs_io pwrite call
to the multi-megabyte swiss-chese file turns into multiple 4k pwrites,
which means that file data blocks are allocated 4k at a time. This can
be fatal to our goal of fragmenting the free space btrees because the
allocator sees a 4k allocation request and uses 4k blocks from the
fragmented parts of the free space to satisfy the "small" request. When
this happens, the XFS populate function cannot fill out the free space
btree to sufficient height and tests fail.
(In regular delalloc mode we'd cache all those small write() in memory
and try for a single large allocation, which we'd generally get.)
To fix this, we need to force the filesystem to allocate all blocks
before freeing any blocks. Split the creation of swiss-cheese files
into two parts: (a) writing data to the file to force allocation, and
(b) punching the holes to fragment free space.
This bug affects only XFS but we convert the one ext4 usage anyway.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Fix this test to use _scratch_mkfs_xfs instead of the open-coded mkfs
call. This is needed to make the test succeed when XFS DAX is enabled
and mkfs enables reflink by default.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
These tests primarily check that writes to a corrupt fs don't take down
the system, and that running repair will fix them. Therefore, redirect
stderr to seqres.full so that we don't fail these tests in DAX mode.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This test depends on the pwrite creating delalloc blocks, which doesn't
happen if the scratch fs is mounted in dax mode (or has an extent size
hint applied). Therefore, check for delalloc blocks and _notrun if we
didn't get any.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Remove duplicated renameat2 system call number for i386.
Signed-off-by: kaixuxia <kaixuxia@tencent.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Awk 5.0.1 is complaining about this backslash and causing false alarm
like this:
warning: regexp escape sequence '\#' is not a known regexp operator
This fix works fine with Awk 3.1.7 , 4.0.2 , 4.2.1 and 5.0.1. This
backslash is not necessary.
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
I discovered a problem in btrfs where we'd end up pointing at a block we
hadn't written out yet. This is triggered by a race when two different
files on two different subvolumes fsync. This test exercises this path
with dm-log-writes, and then replays the log at every FUA to verify the
file system is still mountable and the log is replayable.
This test is to verify the fix
btrfs: fix incorrect updating of log root tree
actually fixed the problem.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add a basic test for the fs-verity built-in signature verification
support, which is an optional feature where the kernel can be configured
to enforce that all verity files are accompanied with a valid signature
by a key that has been loaded into the fs-verity keyring.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This primarily verifies correct ordering of the hooks for each feature:
fscrypt needs to be first.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This test verifies that fs-verity is doing its Merkle tree-based hashing
correctly, i.e. that it hasn't been broken by a change.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This test corrupts various parts of the contents of a verity file, or
parts of its Merkle tree, by writing directly to the block device. It
verifies that this causes I/O errors when the relevant part of the
contents is later read by any means.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Test access controls on the fs-verity ioctls. FS_IOC_MEASURE_VERITY is
allowed on any file, whereas FS_IOC_ENABLE_VERITY requires write access.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This is a basic fs-verity test which verifies:
- conditions for enabling verity
- verity files have expected contents and size
- can't change contents of verity files, but can change metadata
- can retrieve a verity file's measurement via FS_IOC_MEASURE_VERITY
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add common functions for setting up and testing fs-verity. fs-verity is
an ext4 and f2fs filesystem feature which provides Merkle tree based
hashing (similar to dm-verity) for individual read-only files, mainly
for the purpose of efficient authenticity verification. Other
filesystems may add fs-verity support later, using the same API.
Running the fs-verity tests will require:
- Kernel v5.4-rc1 or later configured with CONFIG_FS_VERITY=y
- The 'fsverity' utility program from
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/fsverity-utils.git
- e2fsprogs v1.45.2 or later for ext4 tests, or f2fs-tools v1.11.0 or
later for f2fs tests
Some individual tests will have additional requirements.
For more information about fs-verity, see
https://www.kernel.org/doc/html/latest/filesystems/fsverity.html
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add _filter_xfs_io_fiemap() to clean up the output of
'xfs_io -c fiemap'. This will be used by a function in common/verity.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
The actual lease test code has been added to src/locktest.c (see
previous commits), now create a new lease test script to drive the
test.
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Move common test functions to common directory and call them from the
lock test. This is in preparation for adding a separate lease test.
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>