xfstests-dev.git
10 years agoshared/004: Delayed allocation multi collapse
Namjae Jeon [Sun, 23 Feb 2014 23:11:26 +0000 (10:11 +1100)]
shared/004: Delayed allocation multi collapse

shared/004 tries to test various corner cases with delayed extents
and pre-existing holes for fcollapse range functionality over
different type of extents.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
10 years agoshared/003: Multi collapse range tests
Namjae Jeon [Sun, 23 Feb 2014 23:11:04 +0000 (10:11 +1100)]
shared/003: Multi collapse range tests

shared/003 tries to test various corner cases with pre-existing holes
for fcollapse range functionality over different type of extents.

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
10 years agoshared/002: Delayed allocation collapse range
Namjae Jeon [Sun, 23 Feb 2014 23:10:20 +0000 (10:10 +1100)]
shared/002: Delayed allocation collapse range

shared/002 tries to test various corner cases with delayed extents
for fcollapse range functionality over different type of extents.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoshared/001: Standard collapse range tests
Namjae Jeon [Sun, 23 Feb 2014 23:08:16 +0000 (10:08 +1100)]
shared/001: Standard collapse range tests

shared/001 tries to test various corner cases for fcollapse range
functionality over different type of extents.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: test for atime-related mount options
Koen De Wit [Tue, 18 Feb 2014 21:26:56 +0000 (08:26 +1100)]
generic: test for atime-related mount options

Tests the noatime, relatime, strictatime and nodiratime mount
options.

There is an extra check for Btrfs to ensure that the access time is
never updated on read-only subvolumes. (Regression test for bug
fixed with commit 93fd63c2f001ca6797c6b15b696a484b165b4800)

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: cleanup tests btrfs/030 and btrfs/034
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: cleanup tests btrfs/030 and btrfs/034

As recently suggested by Dave Chinner, make use of the new function
named _run_btrfs_util_prog() to run the btrfs util program, and stop
using run_check for running xfs_io - instead filter xfs_io's output
and add it to the golden output.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add test for send issuing duplicated rmdir ops
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: add test for send issuing duplicated rmdir ops

Regression test for btrfs incremental send issue where an rmdir
instruction was sent multiple times for the same target directory.
The number of times depended on the number of hardlinks against
the same inode inside the target directory. That inode must have
had the highest number of all the inodes that were children of the
directory. This made the btrfs receive command fail immediately once
it received the second rmdir instruction.

This issue is fixed by the following linux kernel btrfs patch:

   Btrfs: send, don't send rmdir for same target multiple times

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add test for incremental send after dir renames
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:21 +0000 (21:18 +1100)]
btrfs: add test for incremental send after dir renames

Regression test for a btrfs incremental send issue related to
renaming of directories. If at the time of the initial send we have
a directory that is a child of a directory with a higher inode
number, and then later after the initial full send we rename both
the child and parent directories, but without moving any of them, a
subsequent incremental send would produce a rename instruction for
the child directory that pointed to an invalid path.  This made the
btrfs receive operation fail.

This issue is fixed by the following linux kernel btrfs patch:

   Btrfs: incremental send, fix invalid path after dir rename

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add regression test for incremental send
Filipe David Borba Manana [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
btrfs: add regression test for incremental send

Test for a btrfs incremental send issue where we end up sending a
wrong section of data from a file extent if the corresponding file
extent is compressed and the respective file extent item has a non
zero data offset.

Fixed by the following linux kernel btrfs patch:

   Btrfs: use right clone root offset for compressed extents

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/005: log test result to right path
Wang Shilong [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
btrfs/005: log test result to right path

We should log test results to $seqres.full not $seq.full.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: ensure bad primary sb crc fails mount
Eric Sandeen [Tue, 18 Feb 2014 10:18:20 +0000 (21:18 +1100)]
xfs: ensure bad primary sb crc fails mount

the commit:
10e6e65 xfs: be more forgiving of a v4 secondary sb w/ junk in v5 fields
broke primary sb CRC validation, not erroring out the mount
if the crc was bad.

This tests that it's fixed, and properly fails the mount on
a bad crc.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: check that junk in V4 superblocks doesn't break growfs
Eric Sandeen [Tue, 18 Feb 2014 10:18:18 +0000 (21:18 +1100)]
xfs: check that junk in V4 superblocks doesn't break growfs

Test that we properly ignore old growfs-induced junk in the unused
portion of secondary V4 superblocks; at one point this would
trip up the verifiers, and cause a subsequent growfs to fail.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/004: fix to make test really work
Wang Shilong [Tue, 18 Feb 2014 10:18:16 +0000 (21:18 +1100)]
btrfs/004: fix to make test really work

So I was wondering why test 004 could pass my previous wrong
kernel patch while it defenitely should not.

By some debugging, i found here perl script is wrong, we did not
filter out anything and this unit test did not work acutally.so
it came out we will never fail this test.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: test setting XFS BMBT fields in xfs_db
Mark Tinguely [Tue, 18 Feb 2014 10:18:16 +0000 (21:18 +1100)]
xfs: test setting XFS BMBT fields in xfs_db

Test the setting of the XFS BMBT fields via xfs_db. Runs through the
valid bit values for each field and tests an illegal value.

[dchinner: added _require_xfs_mkfs_crc and turned off crcs so that
the test doesn't just fail on CRC enabled test runs.]

[dchinner: added hex block values to check they don't get endian
swapped.]

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add test for data corruption when using compression
Filipe David Borba Manana [Tue, 18 Feb 2014 07:04:00 +0000 (18:04 +1100)]
btrfs: add test for data corruption when using compression

Test for a btrfs data corruption when using compressed
files/extents.  Under certain cases, it was possible for reads to
return random data (content from a previously used page) instead of
zeroes. This also caused partial updates to those regions that were
supposed to be filled with zeroes to save random (and invalid) data
into the file extents.

This is fixed by the commit for the linux kernel titled:

   Btrfs: fix data corruption when reading/updating compressed extents
   (https://patchwork.kernel.org/patch/3610391/)

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add a regression test for running snapshot and send concurrently
Wang Shilong [Tue, 18 Feb 2014 06:50:23 +0000 (17:50 +1100)]
btrfs: add a regression test for running snapshot and send concurrently

Btrfs would fail to send if snapshot run concurrently, this test is to make
sure we have fixed the bug.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add new clone overwrite regression test
David Disseldorp [Tue, 18 Feb 2014 06:19:34 +0000 (17:19 +1100)]
btrfs: add new clone overwrite regression test

This test uses the newly added cloner binary to dispatch full file and
range specific clone (reflink) requests.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agosrc/cloner: use btrfs/ioctl.h header if present
David Disseldorp [Tue, 18 Feb 2014 06:18:42 +0000 (17:18 +1100)]
src/cloner: use btrfs/ioctl.h header if present

Check for the btrfsprogs-devel ioctl.h header at configure time. Use it
in src/cloner if present, otherwise fall back to using the copied clone
ioctl definitions.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add small program for clone testing
David Disseldorp [Tue, 18 Feb 2014 06:18:15 +0000 (17:18 +1100)]
btrfs: add small program for clone testing

The cloner program is capable of cloning files using the BTRFS_IOC_CLONE
and BTRFS_IOC_CLONE_RANGE ioctls.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/021: filter v5 filesystem metadata
Dave Chinner [Tue, 18 Feb 2014 06:16:34 +0000 (17:16 +1100)]
xfs/021: filter v5 filesystem metadata

The xfs_db output is different for v5 filesystem metadata, and so
the test fails due to golden image mismatches rather than an actual
test failure. Improve the filter to hide the differences between the
metadata format outputs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/299: users can't modify root owned files
Dave Chinner [Tue, 18 Feb 2014 06:16:26 +0000 (17:16 +1100)]
xfs/299: users can't modify root owned files

xfs/299 has failed for me for a long time. In fact, looking at my
logs it has never passed on any of my test machines. IOWs, the
test that was committed was fundamentally broken.

The reason is that it tests project quotas before it tests user or
group quotas and so creates a bunch of files that are owned by root
or privileged users. It think tries to manipulate them as a user,
and, unsurprisingly, it fails to do so. This then causes the test to
throw an error.

The reason it has always failed is the error that is thrown
hardcodes a uid/gid into an error message. This uid/gid is what
causes the golden output mismatch (nobody is 65534 on my machines,
not 99):

     *** push past the hard block limit (expect EDQUOT)
     [ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
     [NAME] =OK= 100 500 00 [--------] 7 4 10 00 [7 days] 0 0 0 00 [--------]
    - URK 99: 0 is out of range! [425,500]
    + URK 65534: 0 is out of range! [425,500]

It wasn't until I looked at the xfs/299.full file when trying to
understand why the error was being thrown and whether it shoul dhave
been in the golden output in the first place that I saw the real
problem. That is, All the user/group quota modifications were
failing because of not having permissions to write the files left
behind by the quota test, and that user and group quotas were not
being tested at all by the test.

So, firstly $SCRATCH_MNT needs to be world writeable, and secondly
each test needs to remove the files it created during the test so
they don't impact on furture test iterations.

This then exercises the user and group quotas appropriately, and so
the golden output changes completely to reflect that changes under
user quotas are actually being accounted to the correct user.
Further, the error message that I originally saw errors on goes
away, because everything is now accounted correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/008: initialize "valid" bitmap in randholes.c
Eric Sandeen [Thu, 6 Feb 2014 05:43:17 +0000 (16:43 +1100)]
xfs/008: initialize "valid" bitmap in randholes.c

Failures were reported in xfs/008 on s390; dchinner suggested that
perhaps the uninitialized "valid" bitmap was behaving differently on
that platform, and sure enough, this patch fixes things up.

TBH, I'm not sure why using an uninitialized bitmap worked at
all, ever, anywhere...?

[ dchinner explains during review:

It depends on glibc behaviour to whether newly allocated memory is
zeroed or not. e.g. for large allocations glibc uses
mmap() to directly map anonymous pages for the allocation. These get
zeroed by the kernel before being mapped into the user address
space. If glibc allocates from the heap and needs to grow it, it
uses sbrk() to grow the heap and those pages are, again, zeroed by
the kernel. However, if the allocation comes from the heap from
previously freed memory, then it doesn't get zeroed.

I'd say that the 3rd case is occurring here - there's memory that is
allocated and freed as part of the program startup that the bitmap
is being allocated from, and so it's not newly zeroed pages that it
is being allocated from... ]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/066: stat the test file, not the directory
Dave Chinner [Thu, 6 Feb 2014 05:36:17 +0000 (16:36 +1100)]
xfs/066: stat the test file, not the directory

Ever since commit 7e2a19504 ("ls -l reports different file size
depending on platform and user.") xfs/066 has been running stat on
the dump/restore directory instead of the large file that the test
is checking can be dumped and restored correctly. IOWs, it's not
been checking the correct thing for almost 10 years.

This test fails on CRC enabled filesystems because the shortform
directory entry size is different (an extra byte for the filetype
filed), and this is where tracking down the failure has lead me.

Fix this by using the correct target file, and improve it by dumping
an md5sum of the source and target files to ensure they contain the
same data.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/296: fix golden output
Dave Chinner [Thu, 6 Feb 2014 05:36:14 +0000 (16:36 +1100)]
xfs/296: fix golden output

This test never passed, so the golden output was never properly
verified as correct. Now that the bug is fixed, fix the golden
output to match the actual test output.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: inconsistent initial state for test_generic_punch
Dave Chinner [Tue, 4 Feb 2014 00:52:37 +0000 (11:52 +1100)]
generic: inconsistent initial state for test_generic_punch

The first test may start with the file from the previous test, and
that is in an unknown state. Hence always remove the test file
before the first test so that it doesn't have extents inside the
test range as it is supposed to be testing into a hole.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: _test_generic_punch not blocksize clean
Dave Chinner [Tue, 4 Feb 2014 00:52:26 +0000 (11:52 +1100)]
generic: _test_generic_punch not blocksize clean

Test 17 of _test_generic_punch uses the filesystem block size to do
a sub-single block punch. The result of this is a files of
different sizes and md5sums when the filesystem block size changes.
However the only difference in file contents if the length of the
file - the zeroed region is always in the same place. Hence we can
use hexdump rather than md5sum to check the output remains
consistent and the hole remains in the correct place despite the
changing block sizes.

Fix up all the golden output for all the tests that use this
function, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/291: fix spurious ENOSPC errors
Dave Chinner [Tue, 4 Feb 2014 00:52:17 +0000 (11:52 +1100)]
xfs/291: fix spurious ENOSPC errors

xfs/291 tries to fill the filesystem almost full, so if the log size
changes with mkfs defaults then it's free space calculations are not
longer valid and so it throws lots of ENOSPC errors during a run.
This is not fatal for this test, but it does increase the runtime of
it and fill the 291.full file with unnecessary errors.

The number of frag files it creates is also too many for a 512 byte
inode filesystem (by about 900) so reduce the number of inodes
initially created so the test works ofr 512 byte inodes. With 512
byte inodes, the free space histogram looks like this after the frag
phase:

   from      to extents  blocks    pct
      1       1   10730   10730 100.00

And for 256 byte inodes:

   from      to extents  blocks    pct
      1       1   12388   12388 100.00

So these changes do not affect the intended operation of the test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/199: enforce v4 superblock format for test
Dave Chinner [Tue, 4 Feb 2014 00:52:03 +0000 (11:52 +1100)]
xfs/199: enforce v4 superblock format for test

This test relies of the contents of the sb_features2 field being
known. Make sure ot clear allt eh MKFS_OPTIONS and ensure that we
direct mkfs to create only the simplest of featuresets to test this
functionality.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: add test for btrfs incremental send data corruption
Filipe David Borba Manana [Tue, 4 Feb 2014 00:51:08 +0000 (11:51 +1100)]
xfstests: add test for btrfs incremental send data corruption

Btrfs incremental send had an issue where it would detect a non-existent
file hole and then overwrite the file section that hole covers with zeroes,
overriding file data that it shouldn't.

The respective btrfs kernel patch that fixed this issue is titled:

   Btrfs: fix send file hole detection leading to data corruption
   (https://patchwork.kernel.org/patch/3544831/)

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/030: add more test cases
Filipe David Borba Manana [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
btrfs/030: add more test cases

This change adds some new tests for btrfs' incremental send feature.
These are all related with inverting the parent-child relationship
of directories, and cover the cases:

* when the new parent didn't get renamed (just moved)
* when a child file of the former parent gets renamed too

These new cases are fixed by the following btrfs linux kernel patches:

* "Btrfs: more send support for parent/child dir relationship inversion"
* "Btrfs: fix send dealing with file renames and directory moves"

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoext4/306: avoid failures caused by incompatible mount options
Eric Whitney [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
ext4/306: avoid failures caused by incompatible mount options

ext4/306 will fail when mounting the ext3 file system it creates if an
ext3-incompatible mount option is applied by _scratch_mount.  This can
happen if EXT_MOUNT_OPTIONS is defined appropriately in the test
environment.  For example, the block_validity option is commonly used
to enhance ext4 testing, and it is not supported by ext3.

Fix this by instead creating an ext4 file system without extents as a
functionally equivalent substitute.  This will also eliminate a
dependency for ext3 support on the test system.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/299: truncate can fail with ENOSPC
Josef Bacik [Sun, 2 Feb 2014 23:06:50 +0000 (10:06 +1100)]
generic/299: truncate can fail with ENOSPC

So this test does lots of fallocate/truncate noise while doing aio
overwrites to try and exercise a deadlock found in ext4.  Because it
runs so hard with ENOSPC it can sometimes cause truncate to fail on
btrfs.  This is ok and doesn't affect the validity of the test, we
just need to catch the output so it doesn't cause the test to fail.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/313: initialise TEST_DIR before use
Brian Foster [Sun, 2 Feb 2014 23:06:42 +0000 (10:06 +1100)]
generic/313: initialise TEST_DIR before use

The 'testfile' environment variable is initialized before the
xfstests environment is included into generic/313. TEST_DIR is not
defined at this point and causes the test to operate on the root.
Move the testfile initialization down after the general environment
is sourced.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/029: filter mkfs and cp output
Josef Bacik [Sun, 2 Feb 2014 23:06:41 +0000 (10:06 +1100)]
btrfs/029: filter mkfs and cp output

I noticed while testing a different mkfs option that btrfs/029 was
failing because it was getting the extra output from our mkfs.btrfs.
After I fixed that I was still failing because my version of cp will
spit out the source and destination files, not just the destination
file.  So redirect _scratch_mkfs to /dev/null like everybody does
and make the golden output just expect to see "cp failed" instead of
the cp specific output.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: remove spurious line continuation from _require_xfs_crc
Brian Foster [Sun, 2 Feb 2014 23:06:23 +0000 (10:06 +1100)]
xfs: remove spurious line continuation from _require_xfs_crc

This causes the mkfs to fail and leads to tests being skipped.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/025: make test more robust
Filipe David Borba Manana [Sun, 2 Feb 2014 23:06:14 +0000 (10:06 +1100)]
btrfs/025: make test more robust

Make the test btrfs/025 not depend on the output of the btrfs tools
subvolume, send, receive and filesystem commands output. The output
of these commands has changed several times in the past, and it can
change again in the future. Therefore just test for failure/success
and not for the exact output on the success case.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoBtrfs: add regression test for iterating backrefs
Wang Shilong [Sun, 2 Feb 2014 23:05:34 +0000 (10:05 +1100)]
Btrfs: add regression test for iterating backrefs

Btrfs send/scrub/defrag/qgroup need to walk backrefs,this test
is to make sure iterating backrefs with ulist is working and don't
cause a kernel panic here.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoBtrfs: add regression test for transaction abortion when remounting
Wang Shilong [Sun, 2 Feb 2014 22:50:41 +0000 (09:50 +1100)]
Btrfs: add regression test for transaction abortion when remounting

Btrfs would get a transaction abortion when remounting RW to RO with
flushoncommit enabled. This test is to check if bug still exists.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: define $seqres in btrfs/026-029
Koen De Wit [Fri, 24 Jan 2014 01:06:45 +0000 (12:06 +1100)]
xfstests: define $seqres in btrfs/026-029

I forgot to define $seqres in btrfs/026-029. As a result, a file named
.full was created in the current working directory. Fix it.

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: btrfs: cross-subvolume sparse copy
Koen De Wit [Fri, 24 Jan 2014 01:06:31 +0000 (12:06 +1100)]
xfstests: btrfs: cross-subvolume sparse copy

This testscript creates reflinks to files on different subvolumes,
overwrites the original files and reflinks, and moves reflinked files
between subvolumes.

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: clean command names in btrfs tests
David Sterba [Fri, 24 Jan 2014 01:06:14 +0000 (12:06 +1100)]
xfstests: clean command names in btrfs tests

- expand shortened command names
- use $BTRFS_UTIL_PROG instead of 'btrfs'
- fix test 024 header number

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: use value of FSTYP if defined externally
David Sterba [Fri, 24 Jan 2014 01:05:01 +0000 (12:05 +1100)]
xfstests: use value of FSTYP if defined externally

The initial value of FSTYP is unconditionally set to 'xfs' and the
filesystem type is taken from the TEST_DEV. This could lead to confusion
if the device hasn't been formatted yet, eg. an empty image in VM, or
a different test setup took place before.

Now one can specify the desired FSTYP in advance and be safe. If unset,
the fallback to TEST_DEV type continues to work.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: don't suggest to run full diff when DIFF_LENGTH is 0
David Sterba [Fri, 24 Jan 2014 01:04:33 +0000 (12:04 +1100)]
xfstests: don't suggest to run full diff when DIFF_LENGTH is 0

If DIFF_LENGTH is set to 0, the full output is available and the message
does not make sense.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: add test for btrfs incremental send infinite loop issue
Filipe David Borba Manana [Fri, 24 Jan 2014 01:04:18 +0000 (12:04 +1100)]
xfstests: add test for btrfs incremental send infinite loop issue

Regression test for btrfs' incremental send feature:

1) Create several nested directories;

2) Create a read only snapshot;

3) Change the parentship of some of the deepest directories in a reverse
   way, so that parents become children and children become parents;

4) Create another read only snapshot and use it for an incremental send
   relative to the first snapshot.

At step 4 btrfs' send entered an infinite loop, increasing the memory it
used while building path strings until a krealloc was unable to allocate
more memory, which caused a warning dump in dmesg.

The following linux kernel patch fixes this issue.

   Btrfs: fix infinite path build loops in incremental send
   (https://patchwork.kernel.org/patch/3522361/)

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/204: use fixed log size for XFS
Dave Chinner [Mon, 20 Jan 2014 06:22:37 +0000 (06:22 +0000)]
generic/204: use fixed log size for XFS

In changing the default log sizes in mkfs, the freespace
calculations in generic/204 are no longer valid and so it fails with
ENOSPC before ti has finished creating the necessary files.. Make
the test use a fixed log size of 5MB for XFS so that freespace
calculations remain valid and the test passes regardless of whether
we have a new or old mkfs binary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs/104: use fixed log size
Dave Chinner [Mon, 20 Jan 2014 06:22:36 +0000 (06:22 +0000)]
xfs/104: use fixed log size

In changing the default log sizes in mkfs, the freespace
calculations in xfs/104 are no longer valid and so it fails with
ENOSPC before running any of the growfs tests. Make the test use a
fixed log size of 5MB so that freespace calculations remain valid
and the test passes regardless of whether we have a new or old mkfs
binary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs: support xfs_metadump with external logs
Dave Chinner [Mon, 20 Jan 2014 06:22:35 +0000 (06:22 +0000)]
xfs: support xfs_metadump with external logs

When running xfstests with an external log, the metadump tests fail
with extra output like:

    +filesystem is marked as having an external log; specify logdev on the mount command line.
    +xfs_metadump: cannot read superblock for ag 0

Add a _scratch_metadump() function to handle different logdev
configurations automatically for metadump.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs/073, 208: remove .full output before starting the test
Dave Chinner [Mon, 20 Jan 2014 06:22:34 +0000 (06:22 +0000)]
xfs/073, 208: remove .full output before starting the test

Otherwise we end up with an ever-growing file for every test that is
run and that makes it hard to isolate failures.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs: add fsstress/recovery test
Dave Chinner [Mon, 20 Jan 2014 06:22:33 +0000 (06:22 +0000)]
xfs: add fsstress/recovery test

This has found several issues with recovery on CRC based
filesystems. It is based on a test case for a dir3 assert failure
provided by Michael L Semon.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs: New _require_* tests for CRC enabled filesystems
Dave Chinner [Mon, 20 Jan 2014 06:22:32 +0000 (06:22 +0000)]
xfs: New _require_* tests for CRC enabled filesystems

CRCs always enabled 32 bit project inodes and attr2 formats, hence
they cannot be turned off. Add new require rules for the tests that
require attr and 16 bit project IDs so these tests are avoided on
CRC enabled filesystems.

Also, add a xfs_db write check so that we can avoid tests that are
dependent on xfs_db modifying filesystem structures as they will
fail on CRC enabled filessystems right now. This is just temporary
until full write xfs_db support is available.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfs: test scratch device mkfs features
Dave Chinner [Mon, 20 Jan 2014 06:22:31 +0000 (06:22 +0000)]
xfs: test scratch device mkfs features

Some filesystem features are not compatible with certain tests, and
so we need to do require tests to determine if they are supported.
Some of these incompatibilities might be a result of optional mkfs
parameters specified in MKFS_OPTIONS. In this case, we don't want
scratch_mkfs_xfs stripping MKFS_OPTIONS and saying the feature is
supported when the next _scratch_mkfs command in the test will
result in a different mkfs command line.

Hence add a "mkfs supported" function to run a non-destructive mkfs
test to determine if the feature is supported by the current test's
mkfs configuration.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoext4: regression test for ext4 resize with non-extent files
Eric Sandeen [Mon, 20 Jan 2014 07:09:27 +0000 (07:09 +0000)]
ext4: regression test for ext4 resize with non-extent files

Regression test for:

c5c72d8 ext4: fix online resizing for ext3-compat file systems

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agobtrfs: sparse copy between different filesystems/mountpoints
Koen De Wit [Mon, 20 Jan 2014 02:56:37 +0000 (13:56 +1100)]
btrfs: sparse copy between different filesystems/mountpoints

Check if creating a sparse copy ("reflink") of a file on btrfs
expectedly fails when it's done between different filesystems or
different mount points of the same filesystem.

For both situations, these actions are executed:
   - Copy a file with the reflink=auto option.
     A normal copy should be created.
   - Copy a file with the reflink=always option. Should result in
     error.

[sandeen: mostly cosmetic changes]

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: moving and deleting sparse copies on btrfs
Koen De Wit [Mon, 20 Jan 2014 02:56:36 +0000 (13:56 +1100)]
btrfs: moving and deleting sparse copies on btrfs

Moving and deleting cloned ("reflinked") files on btrfs:
   - Create a file and a reflink
   - Move both to a directory
   - Delete the original (moved) file, check that the copy still exists.

[sandeen: mostly cosmetic changes]

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: sparse copy of a directory tree on btrfs
Koen De Wit [Mon, 20 Jan 2014 02:56:36 +0000 (13:56 +1100)]
btrfs: sparse copy of a directory tree on btrfs

Tests file clone functionality of btrfs ("reflinks") on directory trees.
   - Create directory and subdirectory, each having one file
   - Create 2 recursive reflinked copies of the tree
   - Modify the original files
   - Modify one of the copies

[sandeen: mostly cosmetic changes]

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: simple sparse copy testcase for btrfs
Koen De Wit [Mon, 20 Jan 2014 02:56:34 +0000 (13:56 +1100)]
btrfs: simple sparse copy testcase for btrfs

Tests file clone functionality of btrfs ("reflinks"):
   - Reflink a file
   - Reflink the reflinked file
   - Modify the original file
   - Modify the reflinked file

[sandeen: add helpers, make several mostly-cosmetic
 changes to the original testcase]

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agolsqa.pl: update for new tests layout
David Sterba [Mon, 20 Jan 2014 02:28:39 +0000 (13:28 +1100)]
lsqa.pl: update for new tests layout

Accepted parameter types:
- nothing - list all tests from all subdirectories in tests/*
- tests/DIR - list all tests from DIR
- tests/DIR/123 - show header from single test

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocheck: accept tests/ prefix for test name on commandline
David Sterba [Mon, 20 Jan 2014 02:28:39 +0000 (13:28 +1100)]
check: accept tests/ prefix for test name on commandline

Just for convenience to let tab completion or shell globs work (files
that are not in the group file are ignored).

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoMakefile: fix minor build warning
David Sterba [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
Makefile: fix minor build warning

Make in the toplevel directory tries to process the 'group' file that
existed in the previous file layout

$ make
 sed: can't read group: No such file or directory
 sed: can't read group: No such file or directory
 ...

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: allow override of XFS_IOC_DIOINFO
Eric Sandeen [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
xfstests: allow override of XFS_IOC_DIOINFO

This change allows xfstests runs to simulate apps
which don't bother to call XFS_IOC_DIOINFO, and simply
issue DIO in sizes and alignments of its own choosing.

So i.e.:

# export XFS_DIO_MIN=512

prior to an xfstests run, and these test binaries
should issue 512-aligned DIOs instead of whatever
XFS_IOC_DIOINFO says (i.e. instead of maybe 4k).

(This is in preparation for allowing 512 IOs on
"advanced format" 512/4k disks, when xfs has an
internal 4k sector size).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/049, 073: use MKFS_XFS_PROG where appropriate
Eric Sandeen [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
xfs/049, 073: use MKFS_XFS_PROG where appropriate

I got burned on a mishmash system with /usr/sbin/mkfs but
/sbin/mkfs.xfs - or was it the other way around...

Anyway, in these tests, there's no need for the concatenation
to create "mkfs.xfs" - just use MKFS_XFS_PROG.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/001: filter subvol delete output
Anand Jain [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
btrfs/001: filter subvol delete output

btrfs/001 is failing as the below btrfs-progs patch changed the
output during subvol delete.
Patch :
btrfs-progs: add options to set commit mode after subvol delete

adding it to the filter

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs/006: fails with mixed-mode/small disks
Anand Jain [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
btrfs/006: fails with mixed-mode/small disks

as of now the script does not filter 0.00 size  in the
filesystem show output, which is the case in multi-disk
mixed-mode (that is default group type for small disks)

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: test send issue with non-aligned clone operations
Filipe David Borba Manana [Mon, 20 Jan 2014 02:28:38 +0000 (13:28 +1100)]
btrfs: test send issue with non-aligned clone operations

Test for an issue in btrfs send where it sent clone operations to user
space with a range (offset + length) that was not aligned with the block
size. This caused the btrfs receive command to send such clone operations
to the ioctl clone API, which would return -EINVAL errors to btrfs receive,
causing the receive command to abort immediately.

This corresponding btrfs linux kernel patch that fixes this issue is at:

https://patchwork.kernel.org/patch/3470401/

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoaio-stress: use calloc for thread_info array
Jeff Mahoney [Mon, 20 Jan 2014 02:28:27 +0000 (13:28 +1100)]
aio-stress: use calloc for thread_info array

The thread_info array is assumed to be initialized to 0s, but
that causes a segfault when MALLOC_PERTURB_ is set.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
10 years agocommon: Enhance the scratch dev pool and deletable device check
Miao Xie [Mon, 20 Jan 2014 01:52:21 +0000 (12:52 +1100)]
common: Enhance the scratch dev pool and deletable device check

_require_scratch_dev_pool() checks the devices number in
SCRATCH_DEV_POOL, but it's not enough since some btrfs RAID10 tests
needs 4 devices, but when 3 or less devices are provided, the check is
useless and related test case will fail(btrfs/003 btrfs/011 btrfs/023).

Also _require_deletable_scratch_dev_pool only checks whether it is
virtul, like virtio(not including virtio-scsi) disk will pass the check
but is unable to delete.

This patch enhance _require_scratch_dev_pool by add optional $1 as
needed device number to do extra check.
And enhance _require_deletable_scratch_dev_pool by directly check
/sys/class/block/$DEV/device/delete file.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
10 years agobtrfs/022: fix failed case with qgroup limit test
Wang Shilong [Mon, 20 Jan 2014 01:49:16 +0000 (12:49 +1100)]
btrfs/022: fix failed case with qgroup limit test

To have noexceed test, we should clear data before and then retry.
However, when we are near to quota limit, we may fail to truncate/remove
data before, so we restart everthing here.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/321, 322: do not remove lost+found
Lukas Czerner [Mon, 20 Jan 2014 01:48:33 +0000 (12:48 +1100)]
generic/321, 322: do not remove lost+found

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/322: use _filter_scratch()
Lukas Czerner [Mon, 20 Jan 2014 01:47:56 +0000 (12:47 +1100)]
generic/322: use _filter_scratch()

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: Filter out lost+found directory from _ls_l() output
Lukas Czerner [Mon, 20 Jan 2014 01:46:51 +0000 (12:46 +1100)]
common: Filter out lost+found directory from _ls_l() output

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: disable group/project quotas along with fsstress
Jie Liu [Mon, 20 Jan 2014 01:46:01 +0000 (12:46 +1100)]
xfs: disable group/project quotas along with fsstress

Introduce xfs/305 to verify that we can turn group/project quotas
off while user quotas is on and fsstress is running at the same time.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: verify turn group/project quotas off while user quotas is on
Jie Liu [Mon, 20 Jan 2014 01:44:43 +0000 (12:44 +1100)]
xfs: verify turn group/project quotas off while user quotas is on

Introduce xfs/304 to verify that we can turn group/project quotas
off while user quotas is on.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: refactor xfs/299 for crc feature pre-checkup
Jie Liu [Mon, 20 Jan 2014 01:44:02 +0000 (12:44 +1100)]
xfs: refactor xfs/299 for crc feature pre-checkup

Refactor xfs/299 to make use of those two crc related pre-checkup
routines, and remove the super block number from the golden output
file as it does not make sense IMO.  Also, filter out *EXPERIMENTAL*
string from mkfs.xfs output as those contents would be removed once
crc feature becomes stable.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: introduce two pre-checkup routines for xfs crc specified testing
Jie Liu [Mon, 20 Jan 2014 01:42:46 +0000 (12:42 +1100)]
common: introduce two pre-checkup routines for xfs crc specified testing

Introduce two pre-checkup routines _require_xfs_mkfs_crc as well
as _require_xfs_crc to verify if mkfs.xfs and kernel are have crc
feature or not.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoAdd udf support into _scratch_mkfs_sized
Jan Kara [Mon, 23 Dec 2013 22:53:51 +0000 (22:53 +0000)]
Add udf support into _scratch_mkfs_sized

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoFix output parsing in _check_udf_filesystem()
Jan Kara [Mon, 23 Dec 2013 22:53:50 +0000 (22:53 +0000)]
Fix output parsing in _check_udf_filesystem()

Move of tests into separate subdirectories broke sed(1) expression in
_check_udf_filesystem(). Actually use of sed in that place was rather
stupid so just replace it with plain echo.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Add tmpfs support
Boris Ranto [Tue, 10 Dec 2013 20:11:52 +0000 (20:11 +0000)]
xfstests: Add tmpfs support

This is just a simple patch to get the tmpfs working as a target file
system. The patch copies the way nfs is handled in xfstests.

I didn't change the xfstests logic to recognize a proper SCRATCH_DEV.
Hence, the SCRATCH_DEV for tmpfs should be in nfs form (with ':' sign
in it) in order for this to work properly.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Junho Ryu <jayr@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: set umask to avoid spurious generic/314 test failures
Eric Whitney [Sat, 21 Sep 2013 21:17:35 +0000 (21:17 +0000)]
xfstests: set umask to avoid spurious generic/314 test failures

Generic/314 can fail when the group write file mode bit for "subdir" does not
match that found in the golden output, as has been seen in ext4 regression
testing.  It appears that the golden output for generic/314 was taken on a
system where the $qa_user's umask cleared that mode bit - most likely, where
the umask was 022.  Depending upon the distro, it's not uncommon for a user's
default umask to have a different value, such as 002.  When that's the case,
we get a false negative failure when the group write mode bit for "subdir" is
not cleared.  This failure is unrelated to the value of the SGID mode bit
that is the object of this test.

We could either require that $qa_user's account be configured in advance with
a umask of 022, or explicitly set a umask value compatible with the golden
output when creating "subdir".  The latter option is more robust.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agogeneric: require filesize to be greater than fs block size in
Stanislav Kholmanskikh [Wed, 11 Dec 2013 11:21:28 +0000 (11:21 +0000)]
generic: require filesize to be greater than fs block size in

 generic/240
Date: Wed, 11 Dec 2013 11:21:28 -0000
From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>

If we execute generic/240 on a fs which has its fs block size greater
than 64k (for example, NFS), this test will fail with:

  io_submit failed: Invalid argument

This will happen because in src/aio-dio-regress/aiodio_sparse2.c this
expression

  num_aio = filesize / step;

will set num_aio to 0 and this means that no io_prep_write() will happen
before calling io_submit().

Fixing filesize to be 8 * "fs block size".

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstest generic/280: wait for setquota to finish before umount
Guangyu Sun [Thu, 24 Oct 2013 17:56:21 +0000 (17:56 +0000)]
xfstest generic/280: wait for setquota to finish before umount

While running xfstest 280, we occasionally got such error:

  setquota: Cannot set quota for user 0 from kernel on
  /dev/mapper/xfstests-disk1: No such device
  setquota: Cannot write quota for 0 on /dev/mapper/xfstests-disk1: No such
  device

setquota calls syscall quotactl, and the kernel will wait for the filesystem
to unfreeze and then performs command. Then kernel will double check if the
device is still mounted. If not, an ENODEV will be thrown.

While in the testcase, unfreeze and umount might be so close that the device
got umounted before quotactl is performed.

Reported-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redaht.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agogeneric: add a rename fsync test
Josef Bacik [Mon, 2 Dec 2013 23:29:37 +0000 (10:29 +1100)]
generic: add a rename fsync test

Btrfs was screwing up rename+fsync, add some regression tests for
the various scenarios it was screwing up.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: add new test for fsync() on directories
Josef Bacik [Mon, 2 Dec 2013 23:29:36 +0000 (10:29 +1100)]
generic: add new test for fsync() on directories

Btrfs had some issues with fsync()'ing directories and fsync()'ing
after renames.  These three new tests cover the 3 different issues
we were seeing.  This breaks out the dmflakey stuff into a common
helper to be shared between generic/311 and this new test.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add wrong compression type regression test
Miao Xie [Mon, 2 Dec 2013 23:29:34 +0000 (10:29 +1100)]
btrfs: add wrong compression type regression test

Btrfs would crash when the users wrote some data into a file with
compress flag but the compression of the fs was disabled. This test
case is to check this bug still happen or not.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: verify xfs_quota commands against invalid mount path
Jie Liu [Mon, 2 Dec 2013 23:29:33 +0000 (10:29 +1100)]
xfs: verify xfs_quota commands against invalid mount path

Introduce a new test to verify xfs_quota administrator commands can
deal with invalid XFS mount path properly without NULL pointer
dereference issue.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: use correct size value in generic/273
Brian Foster [Mon, 2 Dec 2013 23:29:32 +0000 (10:29 +1100)]
generic: use correct size value in generic/273

generic/273 factors the "space available" output from df into the
calculation for the size of the origin data set. Recent commit

  bfdd1e72b358 xfstests: added -P option to $DF_PROG

... converted the use of 'df' to $DF_PROG. This implicitly adds the
-T parameter to add the fs type column, shifts the available space
column over by one and unintentionally causes 273 to look at "used
space" and create too small of a data set for a useful test.
Realign to the available space value.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: test if raids are actually created
Anand Jain [Mon, 2 Dec 2013 23:29:31 +0000 (10:29 +1100)]
btrfs: test if raids are actually created

A test case to verify if the given raid option for the
metadata and data are actually created.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add basic qgroup testing
Josef Bacik [Mon, 2 Dec 2013 23:29:29 +0000 (10:29 +1100)]
btrfs: add basic qgroup testing

We have no tests for testing qgroups, so we have no way of knowing
if our changes are breaking qgroups at all.  Get the ball rolling
with some basic functionality tests, these just make sure we can
enable quotas and do rescan and get sane values back, as well as
make sure the limiting stuff works properly.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests: stop special casing nfs and udf
Christoph Hellwig [Mon, 2 Dec 2013 23:29:26 +0000 (10:29 +1100)]
xfstests: stop special casing nfs and udf

For historical reasons beyond my knowledge xfstests tries to abuse the
scratch device as test device for nfs and udf.  Because not all test
have inherited the right usage of the _setup_testdir and _cleanup_testdir
helpers this leads to lots of unessecary test failures.

Remove the special casing, which gets nfs down to a minimal number of
failures.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Sugned-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfstests generic/320: heavy rm workload test
Eryu Guan [Tue, 12 Nov 2013 07:59:44 +0000 (07:59 +0000)]
xfstests generic/320: heavy rm workload test

This test is based on generic/273, a regression test for commit

9a3a5da xfs: check for stale inode before acquiring iflock on push

On unpatched kernel, rm processes would hang.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: _filter_mkfs should consume input from stdin for non-xfs fs
Eryu Guan [Tue, 12 Nov 2013 07:59:18 +0000 (07:59 +0000)]
xfstests: _filter_mkfs should consume input from stdin for non-xfs fs

_filter_mkfs is a filter so that it should read from stdin first
before printing anything out. Otherwise the command prior to the
pipeline may get EPIPE.

I saw this when testing extN with generic/204, _scratch_mkfs_sized was
unable to create fs because of EPIPE, then _scratch_mount failed.

generic/204 12s ... [failed, exit status 1] - output mismatch (see /root/xfstests/results//generic/204.out.bad)
    --- tests/generic/204.out   2013-11-01 16:47:56.728591856 +0800
    +++ /root/xfstests/results//generic/204.out.bad     2013-11-01 22:52:53.207828779 +0800
    @@ -1,2 +1,7 @@
     QA output created by 204
    -*** done
    +mount: wrong fs type, bad option, bad superblock on /dev/sda6,
    +       missing codepage or helper program, or other error
    +       In some cases useful info is found in syslog - try
    +       dmesg | tail  or so
    +

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add a helper to get the minimum dio size
Christoph Hellwig [Wed, 6 Nov 2013 10:59:32 +0000 (10:59 +0000)]
xfstests: add a helper to get the minimum dio size

Various tests opencode checks to find out the minimum support direct I/O
size.  Replace those with a generic helper that handles network filesystems as
well.  Also remove the Linux 2.4 workaround we had in once place.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add regression test for running btrfs balance and defrag concurrently
Liu Bo [Thu, 31 Oct 2013 09:34:22 +0000 (09:34 +0000)]
xfstests: add regression test for running btrfs balance and defrag concurrently

The test aims to trigger snapshot-aware defrag path in write endio by
running balance, which is not expected and leads to a crash.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix compile error of src/fssum.c on bigendian host
Eryu Guan [Tue, 12 Nov 2013 04:16:53 +0000 (04:16 +0000)]
xfstests: fix compile error of src/fssum.c on bigendian host

Definition of htonll() is needed on bigendian host too, otherwise
src/fssum.c won't compile on ppc64/s390x hosts.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: added -P option to $DF_PROG
Stanislav Kholmanskikh [Tue, 29 Oct 2013 09:25:24 +0000 (09:25 +0000)]
xfstests: added -P option to $DF_PROG

Added -P option to $DF_PROG and changed the invocation of
'df' command in generic/{251,260,273,275} testcases
with $DF_PROG.

Otherwise the testcases will fail if the scratch
device has a long name (for example, if it's an LVM volume).
Because df outputs its usage stats with two lines:

/dev/mapper/xfstests-disk1
                       3030800      4608   2868908   1% /tmp/mnt/disk1

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/273: use src/feature -o
Stanislav Kholmanskikh [Mon, 11 Nov 2013 09:34:54 +0000 (09:34 +0000)]
xfstests: generic/273: use src/feature -o

Due to partially committed series (fd080d64b6e9677cb9d0a15dc7e308b6ca0e273f)
generic/273 test uses '_no_of_online_cpus' function which is not defined.

Now it's safe to switch it to 'src/feature -o'.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: src/feature.c: print a number of online CPUs
Stanislav Kholmanskikh [Tue, 29 Oct 2013 10:03:59 +0000 (10:03 +0000)]
xfstests: src/feature.c: print a number of online CPUs

For this purpose we use sysconf() as it is the
preferred platform neutral interface for getting this
sort of information.

Based on Dave Chinner proposal.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: posix_memalign and io_submit do not set errno
Christoph Hellwig [Thu, 7 Nov 2013 17:00:45 +0000 (17:00 +0000)]
xfstests: posix_memalign and io_submit do not set errno

posix_memalign and io_submit do not set errno, but rather return the
error respectively the negated error directly.

Found this out while figuring out why 240 reported an impossible error
from io_submit when run on NFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstest: fix filtering in 206 for ftype and projid32bit
Mark Tinguely [Thu, 24 Oct 2013 21:56:42 +0000 (21:56 +0000)]
xfstest: fix filtering in 206 for ftype and projid32bit

xfs/206 displays the output for mkfs.xfs, xfs_growfs and xfs_info.
Change the filtering to hide the new output for the field type
feature.

While cleaning up the ftype output, also clean up the projid32bit
output in xfs_growfs and xfs_info.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix _filter_ro_mount and make xfs/200 pass with old mount
Eryu Guan [Thu, 31 Oct 2013 10:55:16 +0000 (10:55 +0000)]
xfstests: fix _filter_ro_mount and make xfs/200 pass with old mount

We just want to remove "block device" in _filter_ro_mount(), so add
"mount:" back.

Add one more call of _filter_ro_mount() in xfs/200 to match 200.out.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/317 use relative paths to avoid traversal permission problems
Dwight Engen [Wed, 30 Oct 2013 18:30:50 +0000 (18:30 +0000)]
xfstests: generic/317 use relative paths to avoid traversal permission problems

On Wed, 30 Oct 2013 09:24:41 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Wed, Oct 30, 2013 at 09:19:55AM -0700, Christoph Hellwig wrote:
> > On Mon, Oct 28, 2013 at 11:43:28AM -0400, Dwight Engen wrote:
> > > Hi Cristoph, on my system (where fsgqa is id 501) the one liner
> > > the test is running is:
> > >
> > > # ./src/nsexec -s -U -M "0 501 1000" -G "0 501 1000" ./src/lstat64
> > > Usage: lstat64 [-t] filename ...
> >
> > The id here is 1000 and the following works just fine:
> >
> > /src/nsexec -s -U -M "0 1000 1000" -G "0 1000 1000" ./src/lstat64
> > Usage: lstat64 [-t] filename ...
>
> But:
>
> ./src/nsexec -s -U -M "0 1000 1000" -G "0 501
> 1000" /root/xfstests/src/lstat64 execvp: Permission denied
>
>
> Which is probably due to:
> root@vm:~/xfstests# ls -ld ~
> drwx------ 6 root root 4096 Oct 30 16:24 /root
>
>
> Guess we need a relative path here?

Yep, that makes sense. I modeled this on 219 which was using
$here/src/lstat64 but didn't think about the fact that in my test fsgqa
might have traversal problems. I see plenty of other tests are using
relative paths so the following patch should (hopefully) fix 317 for you.
Thanks for tracking it down.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>