Commit Graph

118 Commits

Author SHA1 Message Date
Filipe Manana 72da52702a generic: test directory fsync after rename operation
Test that if we move one file between directories, fsync the parent
directory of the old directory, power fail and remount the filesystem,
the file is not lost and it's located at the destination directory.

This is motivated by a bug found in btrfs, which is fixed by the patch
(for the linux kernel) titled:

  "Btrfs: fix file loss on log replay after renaming a file and fsync"

Tested against ext3, ext4, xfs, f2fs and reiserfs.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-02-19 12:15:17 +11:00
Darrick J. Wong c6f5bb394a reflink: kick the slow tests out of the 'quick' group
Since 'quick' tests are supposed to run in < 15s, kick out the ones
that can't finish that soon even on fast storage.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 130d7f0d1e reflink: test reflink+cow+enospc all at the same time
Set up an impossibly small filesystem and try to reflink and rewrite a
file on it to see what happens when we ENOSPC.  Basically
generic/16[67] but with a constrained fs size.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 3c95f55047 reflink: test aio copy on write
Make sure that copy on write works with the AIO path.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong aad7738cda reflink: test quota accounting
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 2fcbba4ceb reflink: high offset reflink and dedupe tests
Ensure that we can pass absurdly enormous offsets and lengths to
reflink/dedupe and it'll survive.

v2: Ask for dedupe in the dedupe test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: call _require_test_dedupe]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 9184ca155d xfs: test fragmentation characteristics of copy-on-write
Perform copy-on-writes at random offsets to stress the CoW allocation
system.  Assess the effectiveness of the extent size hint at
combatting fragmentation via unshare, a rewrite, and no-op after the
random writes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong ddf6ff2f94 reflink: ensure that we can handle reflinking a lot of extents
Update the existing stress tests to ensure that we can handle
reflinking the same block a million times, and that we can handle
reflinking million different extents.  Add a couple of tests to ensure
that we can ^C and SIGKILL our way out of long-running reflinks.

v2: Don't run the signal tests on NFS, as we cannot interrupt NFS
clone operations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[hch@lst.de: don't run on NFS]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 37059d0ca7 reflink: test CoW operations against the source file
Ensure that CoW operations against shared blocks in the source file
work correctly.

v2: remove filefrag dependencies

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong c741fbfd99 reflink: test CoW behavior with IO errors
Test various scenarios (with dm-flakey) where we simulate write
failures during CoW, to see if the FS can get through it without
blowing up or corrupting data.  Plumb in a FS-generic method to
sort out repairing filesystems after they get hit by IO errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong 58ac6c6424 reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc
Ensure that we correctly handle a CoW operation immediately followed
by a truncate, falloc, fpunch, fzero, fcollapse, and finsert operation
in the middle of the CoW'd region before any flush can occur.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Darrick J. Wong be32a7f154 dio: unwritten conversion bug tests
Check that we don't expose old disk contents when a directio write to
an unwritten extent fails due to IO errors.  This primarily affects
XFS and ext4.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-02-12 09:39:05 -08:00
Eric Sandeen 1dfb50585c quota: test Q_GETNEXTQUOTA
The new Q_GETNEXTQUOTA quotactl (not yet merged) is designed
to take an ID as input ala Q_GETQUOTA, and return the quota
for the next active ID >= the input ID.  This lets us quickly
iterate over all existing quotas by leveraging the kernel's
knowledge of which quotas are allocated and active.

The test contains a new helper binary, test-nextquota, which
tests both the "vfs" and "xfs" versions of the quotactl.
It accepts an ID, and outputs the returned ID, ihard, and
isoft values for that quota.  It doesn't return block information
simply because that can vary depending on fs, block size, etc,
and we want something very consistent as output, for verifiation.

The test harness sets quotas for 100 random IDs, remounts,
and uses these quotactls to iterate over all the IDs we set,
using the test binary, making sure we get back what we expect.

Not the prettiest thing, but it works!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-02-08 09:27:14 +11:00
Darrick J. Wong 44f59bd904 generic: create a dedupe group
Create a group for just the deduplication tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:40:16 +11:00
Darrick J. Wong 2a885960ec reflink: test a big CoW operation
Test what happens when we send largeish buffers to CoW all at once.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:36:26 +11:00
Darrick J. Wong 8ceac6e2f7 reflink: test CoW with blocksize < pagesize
Test CoW operations when blocksize < pagesize and the only reflink
block is in the middle of the page.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:35:21 +11:00
Darrick J. Wong c8a13e5303 reflink: more CoW tests for reflink and dedupe
These tests examine the behavior of advanced and tricky copy on write
situations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:27:04 +11:00
Darrick J. Wong 1b3dc467e4 reflink: more tests
Add more tests for unaligned copy-on-write things, and explicitly
test the ability to pass "len == 0" to mean reflink/dedupe all
the way to the end of the file".

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:13:37 +11:00
Xiaoguang Wang f2f13c3735 generic/275: add to the 'enospc' group
Currently we're developing a new in-band deduplication feature for btrfs,
when enabing this feature, it will take much long time to hit the enospc
condition which 275 tries to create. I think 275 is also certain enospc
test and we should add it to 'enospc' group, then we can skip it easily by
excluding 'enospc' group when running fstests.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
2015-12-21 18:01:54 +11:00
Jeff Moyer 7721b85016 generic/042: remove from the 'auto' group
This test fails 100% of the time for me on xfs and current git head, and
is not run for ext4 since ext4 does not support shutdown.  After talking
with bfoster, it isn't expected to succeed right now.  Since the auto
group is for tests that *are* expected to succeed, let's move this one
out.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-12-21 18:01:47 +11:00
Filipe Manana 71f68b47e1 fstests: generic test for fsync after hole punching
Test that a file fsync works after punching a hole for the same file
range multiple times, and that after log/journal replay the file's
content and layout are correct.

This test is motivated by a bug found in btrfs, which is fixed by
the following linux kernel patch:

  "Btrfs: fix hole punching when using the no-holes feature"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-17 08:41:18 +11:00
Darrick J. Wong 727d47730d reflink: test what happens when we hit resource limits
Add a few horrible opt-in stress tests to see what happens if we try
to reflink the same block billions of times, and what happens if we
run out of space while reflinking a file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-17 08:40:17 +11:00
Darrick J. Wong db4284f312 reflink: test that CoW writes fail when we're out of space
Ensure that copy-on-writing a reflinked file when there's no free disk
space reflects the desired ENOSPC back to userspace during the write
call.  Tests the buffered IO, direct IO, and mmap write paths.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-17 08:40:08 +11:00
Darrick J. Wong 5fb5ee48b3 reflink: concurrent operations tests
Make sure that running reflink ops while other IO is ongoing doesn't
break the filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-17 08:40:02 +11:00
Darrick J. Wong f3965fde0a reflink: test error conditions due to bad inputs
Check that we can feed bad inputs to reflink/dedupe and it'll reject
them.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-17 08:39:50 +11:00