There was a bug during log replay, the attr/attr3 leaf verifier
reported corruption when encountering a leaf attribute with a
count of 0 in the header, as below:
Metadata corruption detected at xfs_attr3_leaf block 0x480988/0x1000
commit f714016 from xfsprogs has fixed this bug. This test case
will emulate this corruption by xfs_db and use xfs_repair to fix
it.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Three new tests:
- Repair files that are mapped into memory in running programs
- Run scrub -n concurrently with fsstress
- Run scrub -y concurrently with fsstress
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
xfs/348 is a fuzzer test since it calls xfs_db to break the scratch fs,
so put it in the fuzzers group.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
In a DAX mountpoint, do IO betwen files with and
without DAX per-inode flag. We do mmap, both
O_DIRECT and buffered read/write IO in this case.
Then test again in the same device without dax
mountoption.
Add help _require_scratch_dax to make sure we can
test DAX feature on SCRATCH_DEV.
Add mmap dio test programme to test read/write
between a mmap area of one file and another file
directly or buffered, with different size.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This test is based on generic/033, which originally used zero range
operations to reproduce indlen reservation problems. Zero range now
includes a pagecache flush before it updates extents, which means
generic/033 is no longer able to reproduce the problem it was
originally written to test.
Create a new test that uses an XFS-specific mechanism (in DEBUG
mode) to induce delalloc extent splits and reproduce the problem
originally reproduced by generic/033. In addition, update the test
to include a larger buffered write pattern that is known to
reproduce premature indlen exhaustion on delalloc extents.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Make sure that the 'source' command works correctly whether supplied
via command line or interactive prompt.
You probably want "xfs_db: fix the 'source' command when passed as a
-c option" in xfsprogs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Previously, our XFS fuzzing efforts were limited to using the xfs_db
blocktrash command to scribble garbage all over a block. This is
pretty easy to discover; it would be far more interesting if we could
fuzz individual fields looking for unhandled corner cases. Since we
now have an online scrub tool, use it to check for our targeted
corruptions prior to the usual steps of writing to the FS, taking it
offline, repairing, and re-checking.
These tests use the new xfs_db 'fuzz' command to test corner case
handling of every field. The 'print' command tells us which fields
are available, and the fuzz command can write zeroes or ones to the
field; set the high, middle, or low bit; add or subtract numbers; or
randomize the field. We loop through all fields and all fuzz verbs to
see if we can trip up the kernel.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Set all possible file type values for different types of files
and verify that xfs_repair detects the correct errors.
When setting invalid file type values (e.g. core.mode = 0170644),
all files are expected to have been junked by xfs_repair.
When setting valid file type values to non matching file types,
xfs_repair would either detect wrong format and junk the file, e.g.:
would have junked entry "DATA" in directory PARENT_INO
or detect a ftype mismatch error, e.g.:
would fix ftype mismatch (5/3) in directory/child PARENT_INO/FIFO_INO
If ftype feature is enabled, when setting file type to one of the
special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
xfs_repair is expected to detect ftype mismatch error. Otherwise,
xfs_repair is not expected to detect ftype mismatch error.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Craft a malicious filesystem image with a negative inode size,
then try to trigger a kernel DoS by appending data to the file.
Ideally this should trigger verifier errors instead of hanging.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Failure results in an oops, so add it to dangerous.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This is a testcase for a bug which goes way back; googling
"xfs_trans_log_inode NULL pointer dereference" yields sporadic
reports over several years.
The test sets up several two-extent files with speculative
preallocation on them, and then runs xfs_fsr. The kernelside
code ignores the preallocation, and therefore sets up the
temporary inode incorrectly after the inode fork swap.
It is a "dangerous" test because the extent mishandling on
the temporary inode causes a null pointer dereference and
oops when the inode's i_itemp pointer gets overwritten
and we blow up in logging code that tries to use it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Tests were merged with high seq numbers to avoid conflicts with
other tests. Now renumber them to contiguous numbers, as all other
tests have been merged correctly. This is easier to do than
assigning the final seq numbers at commit time.
Signed-off-by: Eryu Guan <eguan@redhat.com>
Test the realtime rmap btree code by exercising various IO patterns
on realtime files.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Run various modes of the xfs_io "inode" command.
This fails today, I have some patches to fix it up.
The "grep -q" for failures strings are fairly loose
because I'm changing them, and don't want to depend
on the exact error or usage message ...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Now that these tests have been made generic, move them into the
generic/ dir and update group files.
xfs/133 -> generic/383
xfs/134 -> generic/384
xfs/196 -> generic/385
xfs/262 -> generic/386
Signed-off-by: Eryu Guan <eguan@redhat.com>
Now that these tests have been made generic, move them into
the generic/ dir and update group files.
xfs/054 -> generic/379
xfs/118 -> generic/380
xfs/138 -> generic/381
xfs/260 -> generic/382
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
xfsprogs takes use of ustat(2) to check if a given device is
mounted, but ustat(2) is deprecated and may not be available on
newer architectures, e.g. aarch64. In such cases, xfsprogs failed to
detect mounted device, which would result in something like
xfs_mdrestore overwriting a mounted XFS.
So adding a case to do xfs_mdrestore, xfs_copy, xfs_db, mkfs and
xfs_repair against mounted XFS to make sure they refuse to do so.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Although ro-compat features cannot be mounted rw, a bug allows an
ro->rw remount transition, and this will corrupt the filesystem if
it contains ro-compat features unknown to the running kernel.
This bug has been fixed on linux kernel (d0a58e8 xfs: disallow rw
remount on fs with unknown ro-compat features), this case is the
regression testcase of that bug.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Define test groups for those tests which have _require_xfs_io_command
for punch, collapse, insert, and zero. This makes it easier to
exclude tests that use one of these fallocate commands. Or if you
want to specifically test for those fallocate commands you can do
this.
This obviates an out-of-tree xfstests patch I maintain which used an
XFS_IO_AVOID environment variable to suppress running tests that use
punch, collapse, insert, etc. This was rejected because of the
claim that it could be done using groups. So this commit is in
response to those upstream comments.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>