xfstests-dev.git
8 years agologgen: fix build vs. newer xfsprogs headers
Jeff Layton [Thu, 15 May 2014 01:34:56 +0000 (11:34 +1000)]
loggen: fix build vs. newer xfsprogs headers

v2: just include xfs/libxfs.h for the conftest prerequisites

commit cc085d770adb in xfsprogs removed some header files that are
included by loggen.c. Add an autoconf test that checks to see whether
xfs_log_format.h is present. If it is, include that instead of the
deprecated headers and add an alias for XFS_TRANS_MAGIC since that
value no longer exists.

With this patch, xfstests builds on both f20 and rawhide (f21) boxes.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agolocktest: add a F_GETLK vs. openmode test
Jeff Layton [Tue, 13 May 2014 05:30:24 +0000 (15:30 +1000)]
locktest: add a F_GETLK vs. openmode test

POSIX says that you're allowed to do F_GETLK for a F_WRLCK on an
O_RDONLY file description.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agolocktest: consolidate do_lock and do_unlock, and add ability to F_GETLK
Jeff Layton [Tue, 13 May 2014 05:30:23 +0000 (15:30 +1000)]
locktest: consolidate do_lock and do_unlock, and add ability to F_GETLK

Eliminate do_unlock as it's just cut-and-paste of do_lock (down to the
bad stderr fprintf). Fix the debug messages to print the cmd and type,
and add the ability to do a WRTEST and RDTEST.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agolocktest: set f_fd to INVALID_HANDLE on close
Jeff Layton [Tue, 13 May 2014 05:30:23 +0000 (15:30 +1000)]
locktest: set f_fd to INVALID_HANDLE on close

Ensure that the fd is marked invalid after close. Also, the "closed"
and "reopen" variables are always set to 0. Remove them.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agolocktest: don't assume that F_OPEN should use O_RDWR
Jeff Layton [Tue, 13 May 2014 05:30:18 +0000 (15:30 +1000)]
locktest: don't assume that F_OPEN should use O_RDWR

In a later patch, I'll be adding a test for F_GETLK that will require
that we open the file with a different f_mode. Change do_open not to
assume that the it needs to open the file O_RDWR.

While we're at it, fix a bug in do_open. Just because we pass in '0' for
the flags, doesn't mean that this is the initial open.  Move the exit(1)
for that case to the caller.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: fix selinux context handling
Josef Bacik [Tue, 13 May 2014 05:30:15 +0000 (15:30 +1000)]
config: fix selinux context handling

With the new config stuff we lost the selinux options being set for systems with
selinux turned on.  We want the selinux context set all the time, wether we
provide a MOUNT_OPTIONS value or not, so take this logic out of _mount_opts()
and just put it in the body of common/config

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: fix flink check
Josef Bacik [Tue, 13 May 2014 05:30:03 +0000 (15:30 +1000)]
common: fix flink check

I don't have flink support in my xfsprogs, but it doesn't fail with "command not
found" or whatever, it fails because I don't have the -T option, whereas Eric
gets an error about $TEST_DIR being a directory because his xfs_io tries to open
the directory first before it parses the options.  So fix this by checking flink
with these two cases and don't run if we hit either of them.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add regression test for inode cache vs tree log
Wang Shilong [Tue, 13 May 2014 05:29:37 +0000 (15:29 +1000)]
btrfs: add regression test for inode cache vs tree log

This patch adds a regression test to verify btrfs can not
reuse inode id until we have committed transaction. Which was
addressed by the following kernel patch:

 Btrfs: fix inode cache vs tree log

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>
8 years agocommon: use a relative path to fsstress
hch@infradead.org [Tue, 13 May 2014 05:28:37 +0000 (15:28 +1000)]
common: use a relative path to fsstress

All commands run as $qa_user should use a relative path so that
missing access permissions on $HOME for root don't prevent running
it.  This fixes common/233 for me.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/013: stress the free inode btree
Brian Foster [Tue, 13 May 2014 05:28:35 +0000 (15:28 +1000)]
xfs/013: stress the free inode btree

Create a stress test for the free inode btree. Allocate a set of inodes
sequentually and run a hard link clone and random replacement algorithm
across the set. Background removal of the oldest directories creates a
sparse set of free inodes over time. Run an fsstress workload
concurrently to exercise the fs.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/010: test repair for finobt corruption
Brian Foster [Tue, 13 May 2014 05:27:47 +0000 (15:27 +1000)]
xfs/010: test repair for finobt corruption

The finobt creates a duplicate subset of inode allocation metadata from
the inobt. xfs_repair should detect and repair inconsistencies in the
finobt that could be caused by bugs or corruption. This test uses xfs_db
to cause targeted corruptions in the finobt and verify repair detects
and corrects the filesystem.

In particular, the test corrupts individual finobt records to cause
inconsistency between the inode allocation count fields as well as
causing the finobt to contain a record with no free inodes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agorepair: filter agno/ino repair output for finobt
Brian Foster [Tue, 13 May 2014 05:27:47 +0000 (15:27 +1000)]
repair: filter agno/ino repair output for finobt

finobt enabled filesystems can generate new repair output. Update
_filter_repair() to ensure specific AG and inode numbers are filtered
from test output.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: add _require_xfs_[mkfs_]finobt() checks for finobt tests
Brian Foster [Tue, 13 May 2014 05:27:30 +0000 (15:27 +1000)]
common: add _require_xfs_[mkfs_]finobt() checks for finobt tests

Free inode btree tests must ensure that the userspace and kernel bits
are compatible. Add a couple checks for the associated support.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/030: filter out extra repair noise for finobt enabled fs'
Brian Foster [Tue, 13 May 2014 05:26:59 +0000 (15:26 +1000)]
xfs/030: filter out extra repair noise for finobt enabled fs'

xfs/030 nukes various on-disk data structures to test for repair. This
can result in extra output when testing finobt enabled filesystems. For
example, xfs_repair detects an invalid free inode btree root block when
the agi is zeroed.

Filter this output directly in xfs/030 such that the test passes for
finobt and non-finobt filesystems.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: fix incorrect if condition check for collapse range mode
Namjae Jeon [Tue, 13 May 2014 05:26:59 +0000 (15:26 +1000)]
fsstress: fix incorrect if condition check for collapse range mode

There is if condition to be block aligned for off and len of Collapse range.
But off and len for all fallocate opearion can be aligned by incorrect
if condition check.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: new function to get real device path name and basename
Eryu Guan [Mon, 12 May 2014 23:05:43 +0000 (09:05 +1000)]
common: new function to get real device path name and basename

If TEST_DEV or SCRATCH_DEV is symlink(mostly a lvm lv), a simple
basename is not enough, symlink should be followed.

This task is common enough, so introduce new helper functions and
replace all readlink calls in

ext4/305
generic/009
generic/019
generic/285
generic/312

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: add support for an external file containing tests to exclude
Theodore Ts'o [Mon, 12 May 2014 23:04:13 +0000 (09:04 +1000)]
check: add support for an external file containing tests to exclude

Currently the -X option is intended to specify a set of expunging
files which are stored in each test/* subdirectory.  As described in
the commit description for 0b1e8abd4, in order to exclude the test
generic/280, the -X option is used as follows:

    $ cat tests/generic/3.0-stable-avoid
    280
    $ sudo ./check -X 3.0-stable-avoid generic/280

However, it is sometimes useful to store the set of expunged tests in
a single file, outside of tests/* subdirectories.  This commit enables
the following:

    $ cat /root/conf/data_journal.exclude
    generic/068
    ext4/301
    $ sudo ./check -E /root/conf/data_journal.exclude -g auto

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: Use _require_xfs_io_command() instead of helpers
Lukas Czerner [Mon, 28 Apr 2014 00:55:12 +0000 (10:55 +1000)]
common: Use _require_xfs_io_command() instead of helpers

Number of helpers for checking xfs_io functionality is slowly
growing.  But it's as easy to simply use _require_xfs_io_command()
directly and just specify the command we want to check. It will also
avoid the need to create helper every time we need to check a new
command in xfs_io.

Remove all the helpers and use _require_xfs_io_command() in the
tests.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: introduce new large ACL test
Dave Chinner [Mon, 28 Apr 2014 00:55:12 +0000 (10:55 +1000)]
generic: introduce new large ACL test

Having just removed the largeacl test from the shared ACL test,
reintroduce the same test as an generic test so that we can
handle the different limits in supported ACL count appropriately
across different filesystems and different configurations within
filesystem types.

Filesystems have to add support to _acl_get_max to run
this test - the default behaviour right now is to throw a
notrun error like this:

generic/026 14s ... [not run] ext4 does not define maximum ACL count

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared/051: remove ACL count subtest
Dave Chinner [Mon, 28 Apr 2014 00:55:04 +0000 (10:55 +1000)]
shared/051: remove ACL count subtest

Different versions of XFS support different numbers of ACLs on disk.
Remove that subtest from this shared test to prevent it form causing
spurious failures on filesystems that support more than 25 ACLs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofilter: xfs_repair emits new corruption messagse
Dave Chinner [Mon, 28 Apr 2014 00:54:53 +0000 (10:54 +1000)]
filter: xfs_repair emits new corruption messagse

xfs_repair now dumps metadata and CRC corruption information to the
output from the verifier infrastrcuture. Filter this out so that it
doesn't cause spurious test failures such as in xfs/030 and xfs/033.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: remove dmapi tests from the auto group
Dave Chinner [Mon, 28 Apr 2014 00:54:45 +0000 (10:54 +1000)]
xfs: remove dmapi tests from the auto group

There is no mainline kernel support for DMAPI in XFS, and so every
time the xfstests auto group is run it throws a large number of
"[not run] Assuming DMAPI modules are not loaded". I've noted that
people are excluding the dmapi group to avoid this, so rather than
inflict pain on everyone, make hose few that need to do dmapi
testing include it specifically.

IOWs, remove the DMAPI tests from the auto group.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: cleanup space after test in TESTDIR
Dave Chinner [Mon, 28 Apr 2014 00:54:38 +0000 (10:54 +1000)]
generic: cleanup space after test in TESTDIR

A couple of tests leave behind large files or directory structures
when they complete, which leads to small TEST_DEVs running out of
space during other tests. Make those space hogs clean up after
themselves so that random tests don't fail with ENOSPC errors.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/204: tweak reserve pool size
Dave Chinner [Mon, 28 Apr 2014 00:54:27 +0000 (10:54 +1000)]
generic/204: tweak reserve pool size

On small block size filesystems, the reserve pool size is kept
constant at 4MB. filesystems with smaller blocks use comparitively
more blocks for indexing metadata (e.g. in the inode and extent
btrees) and so having a higher indirect block usage. Hence we need
to leave the reserve pool at 1024 block and not scale it for a
constant size.

This makes the test pass on a filesystem made with MKFS_OPTIONS="-b
size=1024 -m crc=1".

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/167: need at least 10GB of scratch space to run
Dave Chinner [Tue, 22 Apr 2014 01:00:55 +0000 (11:00 +1000)]
xfs/167: need at least 10GB of scratch space to run

When running on a ramdisk, the fsstress background workload consumes
a GB of disk space every 5 seconds. This leads to the test failing
with ENOSPC because the test file cannot be created due otthe
background load cosuming it all. Hence don't run this test unless
the scratch device is large enough not to hit ENOSPC conditions.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/009: fix check for zero range support
Eric Whitney [Tue, 22 Apr 2014 00:47:53 +0000 (10:47 +1000)]
generic/009: fix check for zero range support

Generic/009 fails when run on a file system that does not support byte range
zeroing.  For example, an EOPNOTSUPP failure occurs when the test is run
on a pre-3.15 extent-mapped file system.  The code in the test intended
to prevent this contains an apparent typo that results in a check for
fallocate() rather than zero range support.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoext4/001: fix check for zero range support
Eric Whitney [Tue, 22 Apr 2014 00:47:33 +0000 (10:47 +1000)]
ext4/001: fix check for zero range support

Ext4/001 fails when run on a file system that does not support byte range
zeroing.  For example, an EOPNOTSUPP failure occurs when the test is run
on a pre-3.15 extent-mapped file system.  The code in the test intended
to prevent this contains an apparent typo that results in a check for
fallocate() rather than zero range support.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: add helper for zero range support check
Eric Whitney [Tue, 22 Apr 2014 00:47:28 +0000 (10:47 +1000)]
common: add helper for zero range support check

Add a helper function to verify fallocate zero range support in a style
similar to _require_xfs_io_falloc_collapse(), etc.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: test X_QUOTARM functionality
Eric Sandeen [Tue, 22 Apr 2014 00:47:28 +0000 (10:47 +1000)]
xfs: test X_QUOTARM functionality

The Q_XQUOTARM quotactl was not working properly, because
we weren't passing in proper flags.  The xfs_fs_set_xstate()
ioctl handler used the same flags for Q_XQUOTAON/OFF as
well as Q_XQUOTARM, but Q_XQUOTAON/OFF look for
XFS_UQUOTA_ACCT, XFS_UQUOTA_ENFD, XFS_GQUOTA_ACCT etc,
i.e. quota type + state, while Q_XQUOTARM looks only for
the type of quota, i.e. XFS_DQ_USER, XFS_DQ_GROUP etc.

Unfortunately these flag spaces overlap a bit, so we
got semi-random results for Q_XQUOTARM; i.e. the value
for XFS_DQ_USER == XFS_UQUOTA_ACCT, etc.  yeargh.

Anyway, here's a simple test that demonstrates it,
kernel patch to fix it will follow.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/285: fix test for generic SEEK_HOLE/DATA implementations
Konstantin Khlebnikov [Tue, 22 Apr 2014 00:47:23 +0000 (10:47 +1000)]
generic/285: fix test for generic SEEK_HOLE/DATA implementations

Generic implementation of SEEK_HOLE/DATA reports whole file as data chunk with
virtual hole at the end (generic_file_llseek, used by ext2/ext3/reiserfs/nfs).

Currently test prepares file smaller than expected for "huge file" testcases
(testcases 10-12). This patch fixes test file layout, now second data chunk
ends right at the expected end of file.

Plus it fixes type of 'filesz' argument, it should be off_t.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsx: introduce FSX_AVOID env var
Eric Sandeen [Tue, 22 Apr 2014 00:46:49 +0000 (10:46 +1000)]
fsx: introduce FSX_AVOID env var

Just like FSSTRESS_AVOID, FSX_AVOID can be used to add
options at the end of the default fsx runs in each test.
i.e. FSX_AVOID="-H -z -C" will disable punch hole, zero range,
and collapse range calls in all tests which run fsx.

This should handle Ted's concerns about buggy ext4 fallocate
code without needing to add tunables to the kernel to reject
these operations during xfstests runs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/004: fix failure with inlined file extents
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:41 +0000 (10:46 +1000)]
btrfs/004: fix failure with inlined file extents

Files that consist of an inline extent, have the corresponding
data in the filesystem btree and not on a dedicated extent. For
such extents filefrag (fiemap) will report a physical location
of 0 for that extent and set the 'inline' flag.

The btrfs inspect-internal logical-resolve command will cause a
lookup in the extent tree for the extent address we give it as
an argument, which fails with errno ENOENT if it is 0.

This error didn't happen always, as the test uses fsstress to
generate a random filesystem, which needed to generate at least
one file that could be inlined (content less than 4018 bytes).

Example, taken from results/btrfs/004.full:

   # filefrag -v /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1
   Filesystem type is: 9123683e
   File size of /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1 is 3860 (1 block of 4096 bytes)
    ext:     logical_offset:        physical_offset: length:   expected: flags:
      0:        0..    4095:          0..      4095:   4096:             not_aligned,inline,eof
      1:      280..     344:      35190..     35254:     65:          1: eof
   /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1: 2 extents found
   after filter: 0#0#0 0#0#0
   # stat -c %i /home/fdmanana/btrfs-tests/scratch_1/snap1/p0/de/d1b/dcb/fb1
   403
   # /home/fdmanana/git/hub/btrfs-progs/btrfs inspect-internal logical-resolve -P 0 /home/fdmanana/btrfs-tests/scratch_1
   ioctl ret=-1, error: No such file or directory

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/004: fix filefrag filter for files with 1 block only
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:34 +0000 (10:46 +1000)]
btrfs/004: fix filefrag filter for files with 1 block only

If the file consists of a single block, then filefrag mentions
'1 block of ...', and the filter expected 'blocks of ...'.

Example:

$ echo qwerty > foobar
$ filefrag -v foobar
Filesystem type is: ef53
File size of foobar is 7 (1 block of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       0:          0..         0:      1:             unknown,delalloc,eof
foobar: 1 extent found

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>
8 years agocommon: Remove unused functions
Lukas Czerner [Tue, 22 Apr 2014 00:46:25 +0000 (10:46 +1000)]
common: Remove unused functions

Functions like _mount_opts(), _mkfs_opts() and _fsck_opts() are
defined both in common/rc and common/config while used only in
common/config.

Remove those functions from common/rc and update _mount_opts() to match
the superior version of the function.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: set _fs_has_crcs=0 as default in _filter_mkfs()
Eryu Guan [Tue, 22 Apr 2014 00:46:17 +0000 (10:46 +1000)]
common: set _fs_has_crcs=0 as default in _filter_mkfs()

xfsprogs without crc support won't print crc=0/crc=1, so
_filter_mkfs() leaves _fs_has_crcs variable unset, and xfs/033 fails
because of that.

xfs/033 4s ... - output mismatch (see /root/xfstests/results//xfs/033.out.bad)
    --- tests/xfs/033.out       2014-04-16 22:31:49.818350450 -0400
    +++ /root/xfstests/results//xfs/033.out.bad 2014-04-16 22:35:08.264401190 -0400
    @@ -5,6 +5,7 @@
     naming   =VERN bsize=XXX
     log      =LDEV bsize=XXX blocks=XXX
     realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
    +./tests/xfs/033: line 87: [: -eq: unary operator expected
     Corrupting root inode - setting bits to 0
     Wrote X.XXKb (value 0x0)
     Phase 1 - find and verify superblock...

Print _fs_has_crcs=0 to stderr by default, so old xfsprogs could have
this variable set too, and a latter _fs_has_crcs=1 could overwrite it
if the fs does have crc support.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: remove duplicate COLLAPSE_RANGE flags
Namjae Jeon [Tue, 22 Apr 2014 00:46:12 +0000 (10:46 +1000)]
fsstress: remove duplicate COLLAPSE_RANGE flags

Remove duplicate COLLAPSE_RANGE flags

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>
8 years agobtrfs: add test for btrfs properties
Filipe David Borba Manana [Tue, 22 Apr 2014 00:46:04 +0000 (10:46 +1000)]
btrfs: add test for btrfs properties

This test case verifies the btrfs properties feature, a new feature
introduced in the linux kernel version 3.14.

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>
8 years agobtrfs: punch holes and prealloc extents with send
Filipe David Borba Manana [Tue, 22 Apr 2014 00:45:53 +0000 (10:45 +1000)]
btrfs: punch holes and prealloc extents with send

This test verifies that after an incremental btrfs send the
replicated file has the same exact hole and data structure as in
the origin filesystem. This didn't use to be the case before the
send stream version 2 - holes were sent as write operations of 0
valued bytes instead of punching holes with the fallocate system
call, and pre-allocated extents were sent as well as write
operations of 0 valued bytes instead of intructions for the
receiver to use the fallocate system call.

It also checks that prealloc extents that lie beyond the file's
size are replicated by an incremental send.

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>
8 years agorenameat2 syscall: turn EEXIST into ENOTEMPTY
Miklos Szeredi [Wed, 16 Apr 2014 00:19:02 +0000 (10:19 +1000)]
renameat2 syscall: turn EEXIST into ENOTEMPTY

XFS is returning EEXIST rather than ENOTEMPTY for several of
these rename tests. The rename man page says this about the errors:

       ENOTEMPTY or EEXIST
              newpath is a nonempty directory, that is, contains
              entries other than "." and "..".

Which implies that both errors are valid and so the test should pass
in either case.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add renameat2 system call number for i386
Theodore Ts'o [Wed, 16 Apr 2014 00:18:41 +0000 (10:18 +1000)]
generic: add renameat2 system call number for i386

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/024: fix output number
Dave Chinner [Mon, 14 Apr 2014 01:19:23 +0000 (11:19 +1000)]
generic/024: fix output number

Didn't update a patch correctly when renumbering it. This time
on a test that doesn't run on XFS yet, so it avoided smoke tests...

Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add renameat2 system call number for i386
Theodore Ts'o [Mon, 14 Apr 2014 00:45:02 +0000 (10:45 +1000)]
generic: add renameat2 system call number for i386

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/004: fix filtering of expected error message
Theodore Ts'o [Mon, 14 Apr 2014 00:37:33 +0000 (10:37 +1000)]
generic/004: fix filtering of expected error message

The failure message goes to stderr, so we need to redirect stderr to
stdout before running sed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/311: add fallocate() check
Eric Whitney [Mon, 14 Apr 2014 00:37:33 +0000 (10:37 +1000)]
generic/311: add fallocate() check

Generic/311 fails when run on a test filesystem that does not
support fallocate().  Its I/O load is produced by fsync-tester,
which uses fallocate() system calls to allocate blocks for some of
its test cases.  This causes EOPNOTSUPP failures when the test is
run on indirect block-mapped ext4 filesystems.

Verify that the test filesystem supports fallocate() before
proceeding with the test, checking for block allocation
capabilities.  Also, fix a minor error message typo.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/300: add fallocate() checks
Eric Whitney [Mon, 14 Apr 2014 00:37:32 +0000 (10:37 +1000)]
generic/300: add fallocate() checks

Generic/300 fails when run on a test filesystem that does not
support fallocate(). It uses fio's falloc ioengine to generate part
of its I/O load and both allocates blocks and punches holes.  This
causes EOPNOTSUPP failures when the test is run on indirect
block-mapped ext4 filesystems or pre-3.14 ext4 filesystems created
with bigalloc.

Verify that the test filesystem supports fallocate() before
proceeding with the test, checking for both block allocation and
hole punching capabilities.  Also, delete any pre-existing test
output.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: check cross renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:37:32 +0000 (10:37 +1000)]
generic: check cross renameat2 syscall

Check with RENAME_EXCHANGE flag.  This flag indicates that the
source and destination files are to be exchanged.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: check noreplace renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:37:31 +0000 (10:37 +1000)]
generic: check noreplace renameat2 syscall

Check with RENAME_NOREPLACE flag.  This flag indicates that the
rename must fail if the target of the rename exists.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: check plain renameat2 syscall
Miklos Szeredi [Mon, 14 Apr 2014 00:35:27 +0000 (10:35 +1000)]
generic: check plain renameat2 syscall

Check with zero flags.  This is what rename(2) and renameat(2) now
call, so this actually tests the behavior of these syscalls as well.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: add infrastructure for renameat2 syscall tests
Miklos Szeredi [Mon, 14 Apr 2014 00:34:51 +0000 (10:34 +1000)]
common: add infrastructure for renameat2 syscall tests

The renameat2() syscall was merged into 3.15-rc (merge commit:
7df934526c0b).

This adds the shared infrastructure for the actual test scripts.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Add -s option to run only specified sections
Lukas Czerner [Fri, 11 Apr 2014 00:19:29 +0000 (10:19 +1000)]
config: Add -s option to run only specified sections

This commit adds -s option which allows you to specify only certain
sections from the config file to be run. The '-s' argument can be
specified multiple times to allow multiple sections to be run.

The options are still carried between section, that includes the
sections which are not going to be run.

Update README.config-sections as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/022: Fix output file
Lukas Czerner [Fri, 11 Apr 2014 00:18:20 +0000 (10:18 +1000)]
generic/022: Fix output file

In commit 21723cdb, renumbering the test wasn't completed entirely,
leaving the output file with a wrong test number. It should be 022,
fix it.

[dchinner: Yup, my mistake. editted the commit message to reflect
 that.]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/204: correct log size for XFS
Alexander Tsvetkov [Fri, 11 Apr 2014 00:10:25 +0000 (10:10 +1000)]
generic/204: correct log size for XFS

generic/204 fails on device with Advanced Format of 4096 bytes per
physical sector and when partition starts at the 4K boundary/./In
this case filesystem sector/block size will be of 4096 bytes size
and _scratch_mkfs_sized fails because mkfs reports that 5Mb log size
is not enough to create a filesystem, for example attempt to make
filesystem on such partition:

mkfs.xfs -f -bsize=4096 -l size=5m -d size=109051904 /dev/sdb2"

results to:

"log size 1280 blocks too small, minimum size is 1605 blocks"

and generic/204 fails with ENOSPC before it has finished creating
the necessary files. Log size of 7MB is enough for this test to pass.

Signed-off-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: fix specifying configuration value with equality sign
Lukas Czerner [Fri, 11 Apr 2014 00:09:48 +0000 (10:09 +1000)]
config: fix specifying configuration value with equality sign

Currently there is a problem with parse_config_section() when the
configuration value contains equality sign like this for example:

MOUNT_OPTIONS="-o data=journal"

the result will be

export MOUNT_OPTIONS="-o data="journal"

which is not going to work. The reason is that the expression used to
parse the configuration options uses greedy matching '.*'. Fix this by
using non greedy expression to match the first equality sign '[^=]'.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoext4/306: disable 64bit feature too
Eryu Guan [Fri, 11 Apr 2014 00:08:26 +0000 (10:08 +1000)]
ext4/306: disable 64bit feature too

mke2fs ext4 without extent feature will fail if 64bit feature is
enabled in mke2fs.conf

mke2fs 1.42.9 (28-Dec-2013)
Extents MUST be enabled for a 64-bit filesystem.  Pass -O extents to rectify.

So disable 64bit feature together with extent explicitly.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: fix wallclock wrapping problem
Wanlong Gao [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
check: fix wallclock wrapping problem

If a test cross two days, the time may be negative, let's use
the UTC seconds instead, for example:

2014-04-03 23:43:42 ./check generic/074 generic/075 generic/112 generic/113 generic/132 generic/133 generic/231
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 vpx-2 3.14.0-00001-g462fa88
MKFS_OPTIONS  -- -f -bsize=4096 /dev/vdd
MOUNT_OPTIONS -- /dev/vdd /fs/scratch

generic/074  100s
generic/075  220s
generic/112  226s
generic/113  188s
generic/132  18s
generic/133  37s
generic/231  -85401s
Ran: generic/074 generic/075 generic/112 generic/113 generic/132 generic/133 generic/231
Passed all 7 tests

Reported-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Fix setting FSTYP automatically
Lukas Czerner [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
config: Fix setting FSTYP automatically

Currently if the FSTYP is not set, the code to get FSTYP using blikd
would not work. This is because we're using HOSTOS environment variable
which might not be set (at least not on my system) and because it's
already late in the code path.

Fix this by using OSTYP environment variable as a fallback in the case
that HOSTOS does not work and move the check to common/config.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL
Lukas Czerner [Tue, 8 Apr 2014 23:55:52 +0000 (09:55 +1000)]
config: Unset SCRATCH_DEV when deduced from SCRATCH_DEV_POOL

In the case that we already have sections in the config file we
have to make sure that we unset SCRATCH_DEV if it has been deduced from
the SCRATCH_DEV_POOL so that it does not complain about SCRATCH_DEV in
this case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoconfig: Fix SCRATCH_DEV_POOL handling
Lukas Czerner [Tue, 8 Apr 2014 23:55:50 +0000 (09:55 +1000)]
config: Fix SCRATCH_DEV_POOL handling

With changes introduced in 667308dd97bf41382d4ab299fa5b56c235cfeb27
it is no longer possible to use SCRATCH_DEV_POOL variable because of
error:

 common/config: Error: $SCRATCH_DEV should be unset when
 $SCRATCH_DEV_POOL is set

This was because get_next_config() would get called twice and hence it
would complain on the second run that SCRATCH_DEV is already set. Fix
it by making sure that we call get_next_config() only once if there
are no sections in the config file.

Also make sure that we export SCRATCH_DEV in the case we're deducing it
from SCRATCH_DEV_POOL.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Filipe David Manana <fdmanana@gmail.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: fix RESULT_BASE typo in check script
Eric Sandeen [Fri, 4 Apr 2014 06:24:23 +0000 (17:24 +1100)]
check: fix RESULT_BASE typo in check script

RESULT_BASE is what is set & tested, but RESULTS_BASE was
being used in an error message.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: Add fallocate collapse range operation
Lukas Czerner [Fri, 4 Apr 2014 06:23:14 +0000 (17:23 +1100)]
fsstress: Add fallocate collapse range operation

This commit adds collapse operation support for fsstress, which is
meant to exercise fallocate FALLOC_FL_COLLAPSE_RANGE support.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsx: Add fallocate collapse range operation
Lukas Czerner [Fri, 4 Apr 2014 06:22:29 +0000 (17:22 +1100)]
fsx: Add fallocate collapse range operation

This commit adds fallocate FALLOC_FL_COLLAPSE_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs incremental send data corruption
Filipe David Borba Manana [Fri, 4 Apr 2014 06:20:52 +0000 (17:20 +1100)]
btrfs: add test for btrfs incremental send data corruption

Regression test for the btrfs incremental send feature, where the kernel
would incorrectly consider a range of a file as a hole and send a stream
of 0 bytes to the destination (send stream) that would overwrite the
corresponding file region.

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

   Btrfs: send, fix data corruption due to incorrect hole detection
   (https://patchwork.kernel.org/patch/3910081/)

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>
8 years agofs: add directories hash collision test
Hannes Frederic Sowa [Fri, 4 Apr 2014 06:19:28 +0000 (17:19 +1100)]
fs: add directories hash collision test

This tests creates several directories that have the same small (8)
group of hashes to ensure the hash ordering of file and directories
are preserved.

Sample backtrace this test tries to prevent in future:

[ 3856.245843] XFS (vda1): Internal error xfs_trans_cancel at line 966 of file fs/xfs/xfs_trans.c.  Caller 0xffffffffa01186bc
[ 3856.249049] CPU: 1 PID: 866 Comm: rm Not tainted 3.13.6-200.fc20.x86_64 #1
[ 3856.250966] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 3856.252615]  000000000000000c ffff8800d23a7d68 ffffffff8168730c ffff8800cf5462b8
[ 3856.254823]  ffff8800d23a7d80 ffffffffa00d00cb ffffffffa01186bc ffff8800d23a7da8
[ 3856.257241]  ffffffffa00e5459 ffff8800d9ac3400 ffff8800d23a7e30 ffff8800371b6800
[ 3856.259420] Call Trace:
[ 3856.260172]  [<ffffffff8168730c>] dump_stack+0x45/0x56
[ 3856.261717]  [<ffffffffa00d00cb>] xfs_error_report+0x3b/0x40 [xfs]
[ 3856.263472]  [<ffffffffa01186bc>] ? xfs_remove+0x1ac/0x370 [xfs]
[ 3856.270838]  [<ffffffffa00e5459>] xfs_trans_cancel+0xd9/0x100 [xfs]
[ 3856.272783]  [<ffffffffa01186bc>] xfs_remove+0x1ac/0x370 [xfs]
[ 3856.274531]  [<ffffffffa00db40b>] xfs_vn_unlink+0x4b/0x90 [xfs]
[ 3856.276286]  [<ffffffff811c61b8>] vfs_rmdir+0xa8/0x100
[ 3856.277821]  [<ffffffff811c638d>] do_rmdir+0x17d/0x1d0
[ 3856.281021]  [<ffffffff811ba7fe>] ? ____fput+0xe/0x10
[ 3856.285261]  [<ffffffff8108c11c>] ? task_work_run+0xac/0xe0
[ 3856.286952]  [<ffffffff81013a31>] ? do_notify_resume+0x61/0xa0
[ 3856.288693]  [<ffffffff811c9a65>] SyS_unlinkat+0x25/0x40
[ 3856.290407]  [<ffffffff816962e9>] system_call_fastpath+0x16/0x1b
[ 3856.292685] XFS (vda1): xfs_do_force_shutdown(0x8) called from line 967 of file fs/xfs/xfs_trans.c.  Return address = 0xffffffffa00e5472
[ 3856.627330] XFS (vda1): Corruption of in-memory data detected.  Shutting down filesystem
[ 3856.627332] XFS (vda1): Please umount the filesystem and rectify the problem(s)

With help from Mark Tinguely, thanks very much!

[dchinner: changed binary/test file name to dirhash_collide[.c]]

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoext4: Make shared/243 ext4 specific
Lukas Czerner [Fri, 4 Apr 2014 06:18:50 +0000 (17:18 +1100)]
ext4: Make shared/243 ext4 specific

The test shared/243 really is ext4 specific even though currently we
would run it on other file systems as well, it would not actually do any
testing.

So move it to ext4 specific directory and rename it to 002.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: Make some shared tests generic
Lukas Czerner [Fri, 4 Apr 2014 06:18:43 +0000 (17:18 +1100)]
generic: Make some shared tests generic

There are couple of tests in shared directory which really should be
made generic, so move it. It is mostly collapse range tests, which
really can be generic to make super we test every file system which adds
collapse range support.

Here is what we're moving in this commit.

shared/001 -> generic/021
shared/002 -> generic/022
shared/003 -> generic/012
shared/004 -> generic/016
shared/005 -> generic/017
shared/218 -> generic/018
shared/305 -> generic/019

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: unmount TEST_DEV and SCRATCH_DEV after test run
Lukas Czerner [Fri, 4 Apr 2014 06:18:32 +0000 (17:18 +1100)]
check: unmount TEST_DEV and SCRATCH_DEV after test run

Unmount TEST_DEV and SCRATCH_DEV after each test run to avoid
mounting multiple devices on the same mount point which might result
in xfstest not being able to unmount the device later down the path.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Remount file system if MOUNT_OPTIONS changed
Lukas Czerner [Fri, 4 Apr 2014 06:18:24 +0000 (17:18 +1100)]
check: Remount file system if MOUNT_OPTIONS changed

When MOUNT_OPTIONS change we should remount TEST_DEV to put the changes
in effect. This will allow us to have different MOUNT_OPTIONS in sections
in configuration file.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Allow to recreate TEST_DEV
Lukas Czerner [Fri, 4 Apr 2014 06:18:15 +0000 (17:18 +1100)]
check: Allow to recreate TEST_DEV

Add config option RECREATE_TEST_DEV to allow to recreate file system on
the TEST_DEV device. Permitted values are true and false.

If RECREATE_TEST_DEV is set to true the TEST_DEV device will be
unmounted and FSTYP file system will be created on it. Afterwards it
will be mounted to TEST_DIR again with the default, or specified mount
options.

Also recreate the file system if FSTYP differs from the previous
section.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Add support for sections in config file
Lukas Czerner [Fri, 4 Apr 2014 06:18:04 +0000 (17:18 +1100)]
check: Add support for sections in config file

This patch add support for sections in the config file. Each section can
contain configuration options in the format

OPTION=value

when one section is processed xfstests will proceed to next section
until all secitons are processed, or an error occur.

The name of the section can consist of alphanumeric characters + '_',
nothing else is allowed. Name of the section is also used to create
results subdirectory for each section. After all the sections are
processed summary of all runs is printed out.

If the config file does not contain sections, or we're not using config
file at all, nothing is changed and xfstests will work the same way as
it used to.

This is very useful for testing file system with different options. Here
is an example of the config file with sections:

[ext4_4k_block_size]
TEST_DEV=/dev/sda
TEST_DIR=/mnt/test
SCRATCH_DEV=/dev/sdb
SCRATCH_MNT=/mnt/test1
MKFS_OPTIONS="-q -F -b4096"
FSTYP=ext4

[ext4_1k_block_size]
MKFS_OPTIONS="-q -F -b1024"

[ext4_nojournal]
MKFS_OPTIONS="-q -F -b4096 -O ^has_journal"

[ext4_discard_ssd]
MKFS_OPTIONS="-q -F -b4096"
TEST_DEV=/dev/sdc
SCRATCH_DEV=/dev/sdd
MOUNT_OPTIONS="-o discard"

Note that once the variable is set it remains set across the sections, so
you do not have to specify all the options in all sections. However one
have to make sure that unwanted options are not set from previous
sections.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: Prepare for config section
Lukas Czerner [Fri, 4 Apr 2014 06:17:53 +0000 (17:17 +1100)]
check: Prepare for config section

This patch only adds the indentation in place so we will be able
to clearly see and review changes made in the second patch which will
add a loop (instead of always-true condition introduced in this patch)
adding support for config sections. There are no changes in the logic,
only indentation changes.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared: new test to use up free inodes
Eryu Guan [Fri, 4 Apr 2014 06:17:33 +0000 (17:17 +1100)]
shared: new test to use up free inodes

Test fs by using up all inodes and check fs.

Also a regression test for xfsprogs commit
d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path()

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add generic test for fallocate zero range
Lukas Czerner [Fri, 4 Apr 2014 06:17:21 +0000 (17:17 +1100)]
generic: add generic test for fallocate zero range

This is based on xfs/242. This is very similar to ext4/001 however this
test has some tweaks to make it work test zero range on generic file
system. This includes turning off ext4 extents zeroout and disabling
the test for xfs on systems where PAGE_SIZE > 4096.

It is testing extent tree manipulation with fallocate zero range
operation.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs send directory moves/renames
Filipe Manana [Fri, 4 Apr 2014 06:17:01 +0000 (17:17 +1100)]
btrfs: add test for btrfs send directory moves/renames

Regression test for a btrfs incremental send issue where the kernel failed
to build paths strings. This resulted either in sending a wrong path string
to the send stream or entering an infinite loop when building it.
This happened in the following scenarios:

1) A directory was made a child of another directory which has a lower inode
   number and has a pending move/rename operation or there's some non-direct
   ancestor directory with a higher inode number that was renamed/moved too.
   This made the incremental send code go into an infinite loop when building
   a path string;

2) A directory was made a child of another directory which has a higher inode
   number, but the new parent wasn't moved nor renamed. Instead some other
   ancestor higher in the hierarchy, with an higher inode number too, was
   moved/renamed too. This made the incremental send code go into an infinite
   loop when building a path string;

3) An orphan directory is created and at least one of its non-immediate
   descendent directories have a pending move/rename operation. This made
   an incremental send issue to the send stream an invalid path string that
   didn't account for the orphan ancestor directory.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs incremental send
Filipe David Borba Manana [Fri, 4 Apr 2014 06:16:41 +0000 (17:16 +1100)]
btrfs: add test for btrfs incremental send

Regression test for a btrfs incremental send issue where invalid paths for
utimes, chown and chmod operations were sent to the send stream, causing
btrfs receive to fail.

If a directory had a move/rename operation delayed, and none of its parent
directories, except for the immediate one, had delayed move/rename operations,
after processing the directory's references, the incremental send code would
issue invalid paths for utimes, chown and chmod operations.

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

    Btrfs: fix send issuing outdated paths for utimes, chown and chmod

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>
8 years agobtrfs: add test for btrfs send issuing premature rmdir operations
Filipe David Borba Manana [Fri, 4 Apr 2014 06:16:23 +0000 (17:16 +1100)]
btrfs: add test for btrfs send issuing premature rmdir operations

Regression test for btrfs incremental send issue where a rmdir instruction
is sent against an orphan directory inode which is not empty yet, causing
btrfs receive to fail when it attempts to remove the directory.

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

    Btrfs: fix send attempting to rmdir non-empty directories

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>
8 years agogeneric: add a basic O_TMPFILE test
Christoph Hellwig [Fri, 4 Apr 2014 06:15:56 +0000 (17:15 +1100)]
generic: add a basic O_TMPFILE test

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: add flink support to _require_xfs_io_command
Christoph Hellwig [Fri, 4 Apr 2014 06:15:51 +0000 (17:15 +1100)]
common: add flink support to _require_xfs_io_command

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/300: fix golden output
Eric Sandeen [Thu, 13 Mar 2014 04:20:54 +0000 (15:20 +1100)]
xfs/300: fix golden output

This test was written before a solution was in place, I think,
and so the expected output wasn't well tested.

The test does a loop of sparse writes from 6 to 0, but the
.out file expects 6 (not 7) extents.  Fix it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/280: use waidpid instead of ugly sleep
Dmitry Monakhov [Thu, 13 Mar 2014 04:20:28 +0000 (15:20 +1100)]
generic/280: use waidpid instead of ugly sleep

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared/051: add filter to match the golden output for large acls
Jie Liu [Thu, 13 Mar 2014 04:20:18 +0000 (15:20 +1100)]
shared/051: add filter to match the golden output for large acls

On old kernel we return EINVAL if hit the limits of maximum number of
ACLs but return E2BIG on new kernel, which cause the test failes on new
kernel as the output is mismatch to the goldens. This patch fix it by
updating the golden output with the new error message and replacing the
old error message with it via a filter.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add basic functional test for btrfs quota groups
Wang Shilong [Thu, 13 Mar 2014 04:20:09 +0000 (15:20 +1100)]
btrfs: add basic functional test for btrfs quota groups

Add missing test for btrfs quota groups feature,test idea is to create
a parent qgroup that groups some subvolume groups, we try to write
some data into every subvolume and then check if we exceed parent
qgroup's limit size.

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>
8 years agoext4/001: Add ext4 specific test for fallocate zero range
Lukas Czerner [Thu, 13 Mar 2014 04:20:00 +0000 (15:20 +1100)]
ext4/001: Add ext4 specific test for fallocate zero range

This is based on xfs/242. However it's better to make it file system
specific because the range can be zeroes either directly by writing
zeroes, or converting to unwritten extent, so the actual result might
differ from file system to file system. Also xfs results differ
depending on the page size which is not the case for ext4.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsx: Add fallocate zero range operation
Lukas Czerner [Thu, 13 Mar 2014 04:19:58 +0000 (15:19 +1100)]
fsx: Add fallocate zero range operation

This commit adds fallocate FALLOC_FL_ZERO_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: translate flags in fiemap_f
Lukas Czerner [Thu, 13 Mar 2014 04:19:56 +0000 (15:19 +1100)]
fsstress: translate flags in fiemap_f

Translate flags in fiemap_f output to human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofsstress: Add fallocate zero range operation
Lukas Czerner [Thu, 13 Mar 2014 04:19:53 +0000 (15:19 +1100)]
fsstress: Add fallocate zero range operation

This commit adds fzero operation support for fsstress, which is meant to
exercise fallocate FALLOC_FL_ZERO_RANGE support.

Also reorganise the common fallocate code into a single do_fallocate()
function and use flags use the right mode.

Also in order to make more obvious which fallocate mode fsstress is
testing translate fallocate flags into human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobuild: Move fallocate include into global.h
Lukas Czerner [Thu, 13 Mar 2014 04:19:52 +0000 (15:19 +1100)]
build: Move fallocate include into global.h

Move the inclusion of falloc.h with all it's possible defines for the
fallocate mode into global.h header file so we do not have to include
and define it manually in every tool using fallocate.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/008: Add test for fallocate zero range at block boundary
Lukas Czerner [Thu, 13 Mar 2014 04:19:03 +0000 (15:19 +1100)]
generic/008: Add test for fallocate zero range at block boundary

Add test for fallocate zero range at block boundary. This is similar to
the test xfs/290 however this one is generic and we're testing different
block sizes as well - namely 1k, 2k, 4k and 64k. Note that we're not
creating file systems with given block size buy rather test all 4
options.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: create _test_block_boundaries in common/punch
Lukas Czerner [Thu, 13 Mar 2014 04:18:56 +0000 (15:18 +1100)]
common: create _test_block_boundaries in common/punch

Create new function _test_block_boundaries() which is testing content of
the blocks after the operation such as zero, or punch hole. The test is
doing the operation around block boundaries to assure correct behaviour
of the operation on block unaligned ranges.

This has been based on test xfs/290 which has been changed to use this
new function. A small change to the output file was required.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: Create single function for testing xfs_io commands
Lukas Czerner [Thu, 13 Mar 2014 04:18:56 +0000 (15:18 +1100)]
common: Create single function for testing xfs_io commands

Currently there are several function testing various xfs_io commands.
This commit creates _require_xfs_io_command() to test any xfs_command.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoaio-dio: fix error msg in aio-dio-subblock-eof-read.c
Eric Sandeen [Thu, 13 Mar 2014 04:18:42 +0000 (15:18 +1100)]
aio-dio: fix error msg in aio-dio-subblock-eof-read.c

io_getevents returns the number of events; printing its
return as "bytes read" is ... wrong.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for btrfs-progs restore feature
Filipe David Borba Manana [Thu, 13 Mar 2014 04:18:18 +0000 (15:18 +1100)]
btrfs: add test for btrfs-progs restore feature

This is a regression test to verify that the restore feature of btrfs-progs
is able to correctly recover files that have compressed extents, specially when
the respective file extent items have a non-zero data offset field.

This issue is fixed by the following btrfs-progs patch:

    Btrfs-progs: fix restore dealing with compressed extents

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>
8 years agofsstress: add verifiable logging mode
Dmitry Monakhov [Thu, 13 Mar 2014 04:18:01 +0000 (15:18 +1100)]
fsstress: add verifiable logging mode

- It would be useful to have verifiable logging mode which will contain
  only deterministic information which allow to compare two logs files
  generated from two runs with same seed.
- Also add missed help for '-o logfile' option

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: cleanup tests 004, 007, 022 and 025
ZhangZhen [Thu, 13 Mar 2014 04:17:44 +0000 (15:17 +1100)]
btrfs: cleanup tests 004, 007, 022 and 025

As recently suggested by Dave Chinner, make use of the new function
named _run_btrfs_util_prog() to run the btrfs util program.
Filipe David Borba Manana have cleaned up  btrfs/030 and btrfs/034.
I have done the same for the rest ones.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add function _require_fssum()
Filipe David Borba Manana [Thu, 13 Mar 2014 04:17:44 +0000 (15:17 +1100)]
btrfs: add function _require_fssum()

To avoid repeating detection of fssum presence in many btrfs tests, as
suggested by Dave Chinner.

Also exported the variable "here" from the main control script, to avoid
repeating its declaration in every single testcase file. Also removed the
declaration of "here" from btrfs test cases that require the fssum program
only. Removing it from all other test cases will be a separate change.

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>
8 years agoxfs/167: need at least 10GB of scratch space to run
Dave Chinner [Thu, 13 Mar 2014 03:58:39 +0000 (14:58 +1100)]
xfs/167: need at least 10GB of scratch space to run

When running on a ramdisk, the fsstress background workload consumes
a GB of disk space every 5 seconds. This leads to the test failing
with ENOSPC because the test file cannot be created due otthe
background load cosuming it all. Hence don't run this test unless
the scratch device is large enough not to hit ENOSPC conditions.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/217: prevent enospc failures on small test devices
Dave Chinner [Thu, 13 Mar 2014 03:58:31 +0000 (14:58 +1100)]
xfs/217: prevent enospc failures on small test devices

I'm running xfstests against a ramdisk, so I'm limited in size of
the test and scratch devices. While there are large enough to hold a
filesystem image with a 2GB log, the way the log changes position in
an image file as the size of the filesystem increases means that the
aggregated disk space of xfs/217 is more than enough to run a 4GB
TEST_DEV out of space and hence fail the test.

To avoid this problem, punch out the image file between every mkfs
iteration so that it only consumes the space needed by each
individual mkfs tests, not an aggregation of them all.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/003: ensure time changes between stat calls
Dave Chinner [Thu, 13 Mar 2014 03:58:24 +0000 (14:58 +1100)]
generic/003: ensure time changes between stat calls

On a fast device like a ramdisk, kernel time may not have changed
between a stat of a file and some operation on it immediately
afterwards. Hence there is no guarantee that an operation actually
changes the timestamps of a file immediately after it is stat'd.

Hence, ensure that the times will change by sleeping for a second
between the initial stat that reads the timestamps and the
operations that is supposed to modify them. This way we ensure that
the timestamp will change if the filesystem is correctly
implemented.

While there, fix the indenting to be 8 space tabs and correct the
header which is missing the bash shell declaration and the test
number identifier.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/189: noattr2 invalid for CRC enabled filesystems
Dave Chinner [Thu, 13 Mar 2014 03:58:16 +0000 (14:58 +1100)]
xfs/189: noattr2 invalid for CRC enabled filesystems

Version 5 filesystems always have attr2 format enabled, and it
cannot be turned off via the noattr2 mount option. As such, attempts
to mount with noattr2 will be rejected and this causes cascading
failures within the test.

Hence detect if we've created a CRC enabled filesystem, and if this
is the case _notrun 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>
8 years agoxfs/033: add golden output for CRC enabled filesystems
Dave Chinner [Thu, 13 Mar 2014 03:58:09 +0000 (14:58 +1100)]
xfs/033: add golden output for CRC enabled filesystems

CRC enabled filesystems emit different errors on corruption.
Specifically, inode corruption is picked up much earlier due to
verifier failures (e.g. incorrect inode identifier) and so
xfs_repair throws errors sufficiently different that filtering
cannot hide the differences. Hence simply add a new golden output
file and link it appropriately once we know what type of filesystem
we are testing.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoshared/005: Test multiple fallocate collapse
Namjae Jeon [Sun, 23 Feb 2014 23:16:24 +0000 (10:16 +1100)]
shared/005: Test multiple fallocate collapse

We execute collapse range multiple times on same file.  Each
collapse range call collapses a single alternate block.  After the
test execution, file will be left with 80 blocks and as much number
of extents.  We also check for file system consistency after the
completion.

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>