Commit Graph

256 Commits

Author SHA1 Message Date
Eric Sandeen b05ae2d653 xfstests 240: test non-aligned AIO hole-filling
This replicates file corruption we've seen with qemu-kvm when
we use if=virtio,cache=none,aio=native for IO to a sparse
ext4- or xfs-hosted file, and the partitions/filesystems
within that file image are not block-aligned.  (think sector
63 here...)  This results in AIO IOs not aligned to the
filesystem blocks.

This test modifies aiodio_sparse2.c to add an option to start
the file IO at an offset.

When we do 4k writes to a 16k file in 2 threads, starting
at offset 512, we get 0s interspersed in the file where they
should not be:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  01 01 01 01 01 01 01 01  01 01 01 01 01 01 01 01  |................|
*
00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001200  01 01 01 01 01 01 01 01  01 01 01 01 01 01 01 01  |................|
....

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2010-07-23 11:18:59 -05:00
Christoph Hellwig 37b7b5a9e1 xfstests: test the aio unwrittent extent conversion race
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2010-07-14 04:38:58 +02:00
Dave Chinner 794798fa74 xfsqa: test open_by_handle() on unlinked and freed inode clusters
When Christoph and I were discussing bulkstat coherency on IRC, we
realised that inode lookup from bulkstat was not actually looking up
the inode allocation btree in xfs_imap() before reading the inode
buffer from disk in xfs_iread(). Bulkstat uses the same lookup
mechanism as handle validation to avoid shutting down the filesystem
if inode numbers that point to non-inode buffers (i.e. invalid) are
passed in the handle.

The problem with this is that when we delete inodes from disk and we
remove the inode chunk (i.e. deallocate inodes) we mark both the
inodes in memory and the cluster buffer as stale, thereby preventing
it from being written back to disk. The result of this is that some
number of inodes remain on disk looking like allocated, in use
inodes (i.e.  di_mode is not zero).

Hence if we get a cold cache lookup from a stale handle that
references such an inode, we can read the inode off disk even though
it has been deleted because we don't check if the inode is allocated
or not.  If the inode chunk has not been overwritten, then the inode
read will succeed and the handle-to-dentry conversion will not error
out like it is supposed to. The result is that stale NFS filehandles
and open_by_handle() will succeed incorrectly on unlinked files for
cold cache lookups.

This is a bug that has been present ever since the inode chunk
deletion code was implemented. This test exercises the problem and
documents the hoops you have to jump through to reproduce it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-06-25 08:26:25 +10:00
Shi Weihua 96c0dfc5ab xfstests: add check for setfacl by non-owner
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-05-27 21:16:43 +02:00
Shi Weihua b5f3e4df9d xfstests: check for ctime updates on link(2)
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-05-27 21:16:29 +02:00
Jan Kara 20530a3062 Add test for quota accounting after remount read only
Check that quota accounting works after remounting read-only and
then back read-write.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:56 +02:00
Jan Kara 55198907bb Add test of quota limit and info setting
Add test stressing addition and removal of quota structures and setting
of quota grace time.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:56 +02:00
Jan Kara 73bce87319 Add quota accounting test when fsstress is run and quota limits are set low
Test various error recovery paths whether they properly handle EDQUOT failures.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:56 +02:00
Jan Kara bb1911020f Add quota test with fsstress
Run fsstress and verify that quota accounting is correct after it finishes.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:56 +02:00
Jan Kara d3714f7f76 Add test of quota accounting using fsx
Run fsx (and also several fsx threads in parallel) and verify that
quota accounting is correct after they finish.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:56 +02:00
Jan Kara a764d7b39f Test basic quota enforcement
Add a test which checks whether basic quota enforcement works.

Signed-off-by: Jan Kara <jack@suse.cz>
2010-05-25 22:37:45 +02:00
Christoph Hellwig f73e0fb3f2 xfstests: test extent size hints
This is an adapted version of the reproduced in OSS BZ #874, which
shows file corruption when using the extent size hint.

Signed-off-by: Geoffrey Wehrman <gwehrman@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-05-10 19:39:04 +02:00
Amit Arora ae98f7a137 xfstests 228: New testcase to check if fallocate respects RLIMIT_FSIZE
Add a new testcase to the xfstests suite to check if fallocate respects
the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or
not, on a particular filesystem.

Signed-off-by: Amit Arora <aarora@in.ibm.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
2010-05-05 14:15:08 -05:00
Dave Chinner a8fa6ee439 xfsqa: new fsr defragmentation test
This test aims to recreate the conditions that caused xfs_fsr to
corrupt inode forks. The problem was that the data forks between the
two inodes were in different formats due to different inode fork
offsets, so when they swapped the data forks the formats were
invalid.

This test generates a filesystem with a known fragmented freespace pattern and
then abuses known "behaviours" of the allocator to generate files
with a known number of extents. It creates attributes to generate a
known inode fork offset, then uses a debug feature of xfs_fsr to
attempt to defrag the inode to a known number of extents.

By using these features, we can pretty much cover the entire matrix of inode
fork configurations, hence reproducing the conditions that lead to corruptions.
This test has already uncovered one bug in the current kernel code, and the
current fsr (with it's naive attribute fork handling) is aborted on a couple of
hundred of the files created by this test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2010-04-28 15:34:06 +10:00
Eric Sandeen f03e512ff6 xfststests 226: test for prealloc/delalloc/reserved space recapture
Test writing and removing a file in a loop; filesize is 64m,
filesystem size is 256m.  Loop 16 times each for buffered and
direct.

ext4 hits enospc after a couple loops.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Alex Elder <aelder@sgi.com>
2010-04-16 13:20:54 -05:00
Eric Sandeen db5926819a xfsqa: Add fiemap exerciser
Preliminary fiemap testing support based on a test util written by
Josef Bacik.

For now it's only run with preallocation disabled, because xfs has a
tendency to fill in holes with data blocks (EOF prealloc stuff I
think) and similar for explicit preallocation, so this is breaking
the preallocation tests for now, when it finds a "data" block where
it expects a preallocated block.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-03-06 11:24:54 +11:00
Dave Chinner 56cc8b05d4 xfsqa: add delayed allocation @ ENOSPC exerciser
When we deplete the reserve block pool or receive an error during
delayed allocation, we currently toss the page away. If that page
has delayed allocation extents on it, we can fail to remove them and
leave stale delayed llocation extents lying around on the inode.
This can, in certain circumstances, trigger errors later on when the
stale delalloc extent it found again, including tripping a BUG().

Exercise this failure path so that we get code coverage of the fix
that prevents stale delalloc mappings from being left on the inode
when pages are tossed.

This is based on a test case supplied by Lachlan McIlroy.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-03-06 11:22:58 +11:00
Eric Sandeen 45768396f0 xfstests: make 053 and 077 generic
053 and 077 can be generic w/ a little tweaking.

Also change 077's filler to something more likely
to be on a random system under test, and add it
to the enospc group.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-02-05 11:03:37 -06:00
Eric Sandeen 8a5dcff7ca xfstests: 223 - test file alignment on stripe geometry
A first-cut test to ensure that files are well-aligned on filesystems
with stripe geometry.

Several sizes of stripe units are mkfs'd, and then files are written
and fallocated in various multiples of those stripe sizes.
Each file is checked to ensure that the first block is
stripe-aligned.

(Ideally, for any fragmented files, we should ensure that each
fragment start is well-aligned, but this does not do that yet)

(slightly unrelated: don't send scratch mkfs output to /dev/null,
we'd like to see mkfs output and direct it to $seq.full - this
more or less matches _scratch_mkfs_xfs behavior and doesn't
break any tests that I can see)

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-02-03 10:43:53 -06:00
Dave Chinner 31792fea50 xfstests: deprecate busted log printing tests
Tests 018, 081 and 082 read the contents of the log and assume that the
contents will always be the same. They are trying to ensure that the
contents of the log don't change for a given fixed load.

This has several problems - high level changes to the filesystem and
VFS code can change the order and contents of the log. Changes to
the way we sync the filesystem will change the contents of the log.
background writeback occurring in the middle of the test will change
the contents of the log by allowing the tail to move. Even changes
to the default mkfs parameters can break them!

The tests also assume that unmount leaves a dirty log behind. We've
fixed lots of problems in sync and the unmount paths over recent
times, so now a clean unmount leaves a clean log behind. That is,
there is nothing left in the log print output for these tests to
check. IOWs, major surgery is required for these tests to be
returned to their former break-when-something-changes behaviour.

However, these tests are a maintenance nightmare. They spend more
time broken and failing than they do passing, and then it's not long
before they get broken again. They have to cover all sorts of
different permutations of log configurations and that will continue
to grow and increase the complexity of making these tests continue
to work. And to top it all off, I can't remember a bug actually ever
being found by these tests. Hence I think we should just stop using
them altogether.

So this patch deprecates 018, 081 and 082 rather than fixes them.
It introduces a "deprecated" test group and puts them in it. That
means the tests can still be run on older systems where they may
have some use, but will not be run automatically any more, nor
will any attempt be made to keep them up to date or working.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-01-26 14:26:42 +11:00
Dave Chinner 8311e1bac2 xfsqa: filter the fsstress seed output in 104
Otherwise it fails to match the golden output. Also add
the test to the auto group so that it is run regularly now
that the growfs problems are fixed.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-01-21 08:53:17 +11:00
Dave Chinner a015bad394 add simple xfs_fsr test
We have very little fsr test coverage in the test suite right now.
042 is the only test that runs it, and it only defragments a single
file.

Improve the coverage by simply running xfs_fsr of the test
filesystem. This gives xfs_fsr a wide variety of inodes to try to
defragment. A simple test like this would have tripped over the
attr2 fork offset problems in the swap extents ioctl long ago
thanks to the varied nature of inodes the test suite leaves around
in this filesystem.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-01-12 22:51:47 +01:00
Christoph Hellwig 1c0b332934 add a test for ctimes updates in futimens
Add a test to check if we update the ctime properly if not updating
the mtime in futimens.

Uses a C program contributed by Eric Blake <ebb9@byu.net>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
2010-01-12 22:47:21 +01:00
Christoph Hellwig 49743070d0 test quota log replay in 087
By mounting the filesystem with quotas enabled in 087 we exercise the
replay of the quota log items in this tests, which we otherwise don't
test in xfstests.  OSS bugzilla #855 is an example of something caught
by this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
2010-01-12 22:45:26 +01:00
Eric Sandeen 7dcd2217aa Add a test for ENOSPC when fallocating.
Also, add an expected output, not sure how that went missing!

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2009-11-25 16:12:09 -06:00