Commit Graph

386 Commits

Author SHA1 Message Date
Darrick J. Wong ee3f35961f xfs/31[2-7]: hide pwrite fsync errors that are supposed to fail
xfs_io 4.14 will gain the ability to print error messages when
pwrite+fsync fail.  Certain tests use the error injector to cause
failures, so the errors are expected.  Since we test for a shut down
filesystem after the error injection, we can push the error messages to
the log.

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>
2017-11-10 12:33:58 +08:00
Eryu Guan 32a8ebcbe6 fstests: do not call _scratch_mkfs_sized in a pipe
_scratch_mkfs_sized will create a filesystem of the given size, and
call _notrun and exit if current $FSTYP doesn't support sized mkfs.
But when it's called in a pipe, the exit in _notrun only exits from
the subshell created by the pipe not the test itself, and test
continues to run unnecessarily, though the test is still reported as
[notrun] due to existence of $seqres.notrun file.

Fix it by not calling _scratch_mkfs_sized in a pipe, but dumping the
output to a tmp file, which will be fed to _filter_mkfs later.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-11-10 12:33:38 +08:00
Darrick J. Wong 68d2ebf90d xfs/020: check that we have enough space to write out a huge fs
Make sure that we have enough free space on the test fs to create a
60t sparse filesystem.

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>
2017-11-04 13:25:26 +08:00
Darrick J. Wong 14d062b1e9 xfs/013: don't fail because cp ran out of space
Don't fail xfs/013 just because cp -Rl runs out of space to allocate
inodes and sprays the ENOSPC messages into the golden output.  We
want to stress the finobt by using cp to push us near ENOSPC
conditions, so it's fine to let cp run out of space.

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>
2017-11-03 19:04:49 +08:00
Darrick J. Wong b934adce93 xfs: filter and record the unknown block state messages
Record the unknown block state messages that xfs_repair produces
when we nuke the finobt.

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>
2017-11-03 19:04:49 +08:00
Darrick J. Wong 8b190e89fd xfs/122: add inode log formats
The inode log record formats have been standardized, so check them here.

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>
2017-11-03 19:04:49 +08:00
Darrick J. Wong 0862b1d8b6 xfs/333: fix errors with new inode pointer verifiers
Fix test failures with new inode pointer verifiers... and also make
sure that the running xfs actually supports realtime rmap. (This
should stop the current crop of weird test failures since nobody has
rtrmap yet anyway...)

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>
2017-11-03 19:04:49 +08:00
Brian Foster 954d9953c5 xfs: test for NULL xattr buffer problem during unlink
XFS had a bug that resulted in an unexpected NULL buffer during
unlink of an inode with a multi-level attr fork tree. This occurred
due to a stale reference to content in a released/reclaimed buffer.

Use the XFS buffer LRU reference count error injection tag to
recreate the conditions for the bug. Create a file with a
multi-level attr fork tree and then unlink it with buffer caching
disabled.

Commit f35c5e10c6ed ("xfs: reinit btree pointer on attr tree
inactivation walk") fixed the bug.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-10-15 15:16:55 +08:00
Hans Holmberg d565ff1d5a xfs/246: add _require_scratch
The test uses a scratch device, so add _require_scratch so
the test will be skipped instead of failing when $SCRATCH_DEV
has not been specified.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-10-10 21:38:14 +08:00
Dave Chinner 6ba637e0cd fstests: update mkfs.xfs filters for new refactoring
From: Dave Chinner <dchinner@redhat.com>

The new mkfs code adds some output to indicate where the defaults
were sourced from, so filter that out so it doesn't contaminate
tests unnecessarily.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-10-03 17:10:19 +08:00
Darrick J. Wong 8443ff29f2 xfs: test increased overlong directory extent discard threshold
As of 2007, metadump has an interesting "feature" where it discards
directory extents that are longer than 1000 (originally 20) blocks.
This ostensibly was to protect metadump from corrupt bmbt records, but
it also has the effect of omitting from the metadump valid long extents.
The end result is that we create incomplete metadumps, which is
exacerbated by the lack of warning unless -w is passed.

So now that we've fixed the default threshold to MAXEXTLEN, check that
the installed metadump no longer exhibits this behavior.

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>
2017-10-01 19:24:21 +08:00
Xiong Zhou 712bfebcc8 tests: add new group dax
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-30 00:53:29 +08:00
Richard Wareing ea817058b0 xfs: Add test for CVE-2017-14340
Verify kernel doesn't panic when user attempts to set realtime flags
on non-realtime FS, using kernel compiled with CONFIG_XFS_RT.
Unpatched kernels will panic during this test.  Kernels not compiled
with CONFIG_XFS_RT should pass test.

This bug was fixed via commit b31ff3cdf540 ("xfs:
XFS_IS_REALTIME_INODE() should be false if no rt device present") on
the main kernel tree.

[eguan: don't assume fixed position when grepping 't' and add some
comments about why we do this, also remove testfile after test]

Signed-off-by: Richard Wareing <rwareing@fb.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-25 00:14:00 +08:00
Christoph Hellwig b88444413a xfs/310: relax extent count check
If we got over the bmbt length we'll always allocate two extents,
its just that so far getbmap merged them.

Also fix/update some comments.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-19 10:56:45 +08:00
xiao yang 7ef45e8a38 xfs/115: add missing 115 into group file
Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-18 10:45:57 +08:00
Carlos Maiolino 642eb97b9f xfs: Test infinite loop while searching for a free inode slot
Tests the search algorithm for a free inode slot in a specific AG,
done in xfs_dialloc_ag_inobt().

When finobt is not used, and agi->freecount is not 0, XFS will scan
the AG inode tree looking for a free inode slot, but if
agi->freecount is corrupted, and there is no free slot at all, it
will end up in an infinite loop.

This test checks for the infinite loop fix.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-17 22:24:27 +08:00
Darrick J. Wong 1c7f4dbf37 xfs: test rmapbt updates are correct with insert/collapse range
Make sure that we update the rmapbt correctly when we collapse-range
a file and the extents on both sides of the hole can be merged.  We
can construct this pretty trivially with insert-range and write, so
test that too.

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>
2017-09-03 12:20:00 +08:00
Darrick J. Wong 5cec561327 xfs/122: fix the size of fsop_ag_resblks structure
The size of the structure used to retrieve per-AG reserved blocks
status has changed (it's not in a released upstream), so update
xfs/122.

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>
2017-09-03 12:20:00 +08:00
Darrick J. Wong a0c125b496 xfs/013: exit cleaner thread if fsstress dies
In this test, the cleaner thread deletes the directory trees created
by fsstress in order to exercise the free inode btree code.
However, if fsstress dies, the cleaner can end up waiting forever
for a directory that will never be created, which hangs up the test
run. Therefore, abort if fsstress has ended.

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>
2017-09-03 12:19:26 +08:00
Darrick J. Wong fc3c28b307 xfs/{319,323}: don't checksum files after log recovery
These two tests simulate log failure during a reflink operation.
However, the contents of the target of the reflink operation depend
on the block size, so we cannot hardcode md5 hashes in this test.
Since the whole point of the test is to ensure that the the complex
chain of transactions actually finishes no matter where the
interruption, it is sufficient simply to run the usual end-of-test
fsck to look for corrupt metadata.

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>
2017-09-03 12:19:26 +08:00
Zorro Lang fb3c560d49 xfs/095: require 512b sector size SCRATCH_DEV
xfs/095 fails on 4k hard sector size device, due to it runs:

  _mkfs_log "-l version=1 -m crc=0 -d sectsize=512"

So _notrun if SCRATCH_DEV's sector size is bigger than 512b.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-09-03 12:19:26 +08:00
Darrick J. Wong c7daab5f35 xfs: test fuzzing every field of a dquot
See what happens when we fuzz every field of a quota information structure.

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>
2017-08-24 17:05:19 +08:00
Darrick J. Wong 86b3f79bbe xfs: test xfs_db fuzz command verbs
Ensure that the fuzz command does what it says.

[eguan: fixed test failures on non-CRC XFS]

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>
2017-08-22 15:08:05 +08:00
Brian Foster 1cc5517771 xfs: test for log recovery failure after tail overwrite
XFS is susceptible to log recovery problems if the fs crashes under
certain circumstances. If the tail has been pinned for long enough
to the log to fill and the next batch of log buffer submissions
happen to fail, the filesystem shuts down having potentially
overwritten part of the range between the last good tail->head range
in the log. This causes log recovery to fail with crc mismatch or
invalid log record errors.

Add a test that uses XFS DEBUG mode error injection to force the
tail overwrite condition with a known bad (crc mismatch) log write
and tests that log recovery succeeds. Note that this problem is
currently only reproducible with larger (non-default) log buffer
sizes (i.e., '-o logbsize=256k') or smaller block sizes (1k).

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-18 13:39:34 +08:00
Xiao Yang 70076b9394 xfs/424: add check for finobt && update comments
1) This test can check if setting types causes error regardless of
   supporting crc, so we can update existed comments about it.  We
   also add new comments about known issues triggered in this test.

2) When finobt is disabled, xfs_db fails to get current address of
   free_root, as below:
   xfs_db -c "agi" -c "addr free_root" -c "daddr" /dev/sda11
   Metadata CRC error detected at xfs_inobt block 0x0/0x1000
   ...
   Running related tests without finobt makes no sense, so we add
   check for finobt.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-15 17:20:13 +08:00