xfstests-dev.git
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>
10 years agoxfstests: fix mkfs filter on xfs/096
Dave Chinner [Wed, 30 Oct 2013 03:58:55 +0000 (03:58 +0000)]
xfstests: fix mkfs filter on xfs/096

Needs to filter out the new ftype field.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/317 318 need procfs uid_map/gid_map support
Eryu Guan [Tue, 29 Oct 2013 12:17:48 +0000 (12:17 +0000)]
xfstests: generic/317 318 need procfs uid_map/gid_map support

generic/317 and 318 need /proc/<pid>/[uid_map|gid_map], test fail on
older kernels without that support.

Add a _require_ugid_map() function and called by 317 and 318.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/318 use symbolic namespaced ids
Dwight Engen [Thu, 24 Oct 2013 20:11:55 +0000 (20:11 +0000)]
xfstests: generic/318 use symbolic namespaced ids

Christoph, I think the following should fix 318 for you.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests btrfs/020: test device replace on RO btrfs
Eryu Guan [Wed, 23 Oct 2013 16:44:43 +0000 (16:44 +0000)]
xfstests btrfs/020: test device replace on RO btrfs

btrfs replace on readonly fs should not be allowed.

Regression test case for commit:
bbb651e Btrfs: don't allow the replace procedure on read only filesystems

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/273: do not use /proc/cpuinfo
Stanislav Kholmanskikh [Wed, 23 Oct 2013 11:58:44 +0000 (11:58 +0000)]
xfstests: generic/273: do not use /proc/cpuinfo

The content of /proc/cpuinfo file is platform-dependent.
So we can not use it reliably to check a number of available cpus.
It would be better to use sysfs interface, as _no_of_online_cpus() does.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: xfsdump/restore test for partial_reg: Out of records. Extend attrs applied...
Rich Johnston [Mon, 21 Oct 2013 20:02:32 +0000 (20:02 +0000)]
xfstests: xfsdump/restore test for partial_reg: Out of records.  Extend attrs applied early

Multi-stream xfsdump/xfsrestore of more than partialmax wholly-sparse
files segfaults with the following warning:

  "partial_reg: Out of records. Extend attrs applied early."

Add a test that dumps and restores partialmax + 1 wholly-sparse files.

Signed-off-by: Rich Johnston <rjohnston@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests XFS: verify extended attributes after multi-stream xfsdump/xfsrestore
Rich Johnston [Mon, 21 Oct 2013 20:02:31 +0000 (20:02 +0000)]
xfstests XFS: verify extended attributes after multi-stream xfsdump/xfsrestore

Verify extended attributes are not lost after multi-stream
xfsdump/xfsrestore of wholly-sparse files.  The restore succeeds,
however the extended attributes for that file are lost.

Signed-off-by: Rich Johnston <rjohnston@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add regression test for kernel bz 60673 V2
Josef Bacik [Mon, 21 Oct 2013 17:52:08 +0000 (17:52 +0000)]
xfstests: add regression test for kernel bz 60673 V2

There was a problem with send trying to overwrite a file that wasn't actually
the same.  This is a test to check this particular case where receive fails when
it should succeed properly.  I tested this to verify it fails without my fix and
passes with my fix.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: stat the dev we're removing to make sure its' really gone
Josef Bacik [Mon, 21 Oct 2013 16:13:53 +0000 (16:13 +0000)]
xfstests: stat the dev we're removing to make sure its' really gone

I've been periodically failing btrfs/003 because my box sometimes takes a little
longer to unregister the device when we remove it and so the output from btrfs
dev show doesn't match what we are wanting since it still sees the device.  To
fix this just stat and sleep if we still see the device node and only continue
once udev or whatever actually removes the device node so that we don't get
random failures.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: use -F for mkfs.ext4 in btrfs/012
Josef Bacik [Mon, 21 Oct 2013 16:05:16 +0000 (16:05 +0000)]
xfstests: use -F for mkfs.ext4 in btrfs/012

I noticed this test was hanging because mkfs.ext4 wanted to make sure it was ok
to mkfs an entire device.  We need -F so it doesn't ask this question.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: wipefs new device in btrfs/003
Josef Bacik [Mon, 21 Oct 2013 15:53:16 +0000 (15:53 +0000)]
xfstests: wipefs new device in btrfs/003

We changed btrfs device add to check and see if there is an existing fs on the
device we are adding, so you now have to do -f if you want to do this.  In order
to get around checking to see if we have this version of btrfs-progs just wipefs
the device we're adding to make sure the device add will pass no matter which
version of btrfs-progs you have.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: use minimum log size in xfs/016
Brian Foster [Fri, 18 Oct 2013 17:16:14 +0000 (17:16 +0000)]
xfstests: use minimum log size in xfs/016

Test xfs/016 fails to run due to invalid mkfs options. The log size
is reported as too small according to the minimum log size
calculation:

log size 512 blocks too small, minimum size is 853 blocks

Update log_size to the currently specified minimum.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/018: a regression test for subvolume rename
Josef Bacik [Fri, 18 Oct 2013 18:26:30 +0000 (18:26 +0000)]
xfstests: btrfs/018: a regression test for subvolume rename

A user reported a regression where we could no longer rename a subvolume into
another subvolume.  This is a test case to do just that to make sure we don't
regress on this again.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/017: add a regression test for snapshot creation
Josef Bacik [Fri, 18 Oct 2013 18:26:29 +0000 (18:26 +0000)]
xfstests: btrfs/017: add a regression test for snapshot creation

We had a regression where you couldn't snapshot a file system if you mounted it
ro and then remounted it rw.  This is a test that does just that to make sure we
don't have this problem again.  I ran the test without the fix and it blew up,
and then applied the fix and verified that it passed.  Thanks,

Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/016: a hole punching send test
Josef Bacik [Fri, 18 Oct 2013 18:26:26 +0000 (18:26 +0000)]
xfstests: btrfs/016: a hole punching send test

I recently added a patch to avoid sending holes with btrfs send, but I screwed
it up by not sending a hole when we did a hole punch.  This is an xfstest
version of the test I wrote to show that I had a bug and to verify I was fixing
it properly.  This test properly fails with my old patch and passes with my good
patch.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix btrfs/002 to not use the scratch dev pool
Josef Bacik [Fri, 18 Oct 2013 18:26:23 +0000 (18:26 +0000)]
xfstests: fix btrfs/002 to not use the scratch dev pool

This test doesn't need the scratch dev pool and it also doesn't call
_require_scratch_dev_pool, so just kick out the scratch dev pool part of the
test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Test xfs_fsr / swapext management of di_forkoff w/ selinux
Eric Sandeen [Fri, 18 Oct 2013 16:23:14 +0000 (16:23 +0000)]
xfstests: Test xfs_fsr / swapext management of di_forkoff w/ selinux

In some cases selinux's creation of an xattr on the temporary
fd creates a local xattr, but the file we are trying to
defragment has attrs in extent format, and the forkoff mismatch
will cause xfs_fsr to fail.  This test demonstrates it;  I
have old patches sent to the list long ago that should fix
it.  I'll resend them soon.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/015: add a regression test for snapshot creation
Josef Bacik [Fri, 27 Sep 2013 13:55:37 +0000 (13:55 +0000)]
xfstests: btrfs/015: add a regression test for snapshot creation

We had a regression where you couldn't snapshot a file system if
you mounted it ro and then remounted it rw.  This is a test that
does just that to make sure we don't have this problem again.  I
ran the test without the fix and it blew up, and then applied the
fix and verified that it passed.

[rjohnston: renumbered test]

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: make fs for 274 larger
Josef Bacik [Fri, 21 Jun 2013 20:31:10 +0000 (20:31 +0000)]
xfstests: make fs for 274 larger

Btrfs will default to mixed block groups for 1 gigabyte file systems and
smaller, which means data and metadata share the same area.  This makes
generic/274 fail for us because we cannot reserve enough metadata space to do
our writes.  Bumping the scratch fs up to 2 gigabytes allows us to do our normal
metadata/data separation and allows us to pass this test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add specific test for default ACL inheritance
Filipe David Borba Manana [Wed, 16 Oct 2013 16:25:18 +0000 (16:25 +0000)]
xfstests: add specific test for default ACL inheritance

This test is motivated by an issue found by a btrfs user, addressed
and described by the following Linux kernel patch:

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

The steps to reproduce the issue on btrfs are the following:

$ mkfs.btrfs -f /dev/loop0
$ mount /dev/loop0 /mnt
$ mkdir /mnt/acl
$ setfacl -d --set u::rwx,g::rwx,o::- /mnt/acl
$ getfacl /mnt/acl
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::---

$ mkdir /mnt/acl/dir1
$ getfacl /mnt/acl/dir1
user::rwx
group::rwx
other::---

After unmounting and mounting again the filesystem, getfacl returned the
expected default ACL for the subdirectory:

$ umount /mnt/acl
$ mount /dev/loop0 /mnt
$ getfacl /mnt/acl/dir1
user::rwx
group::rwx
other::---
default:user::rwx
default:group::rwx
default:other::---

This means that the underlying ACL xattr was persisted correctly but
the in memory representation of the inode had (incorrectly) a NULL ACL.

[rjohnston: renumbered test to 319]

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix xfs/205 for new log size defaults
Eric Sandeen [Wed, 9 Oct 2013 19:48:45 +0000 (19:48 +0000)]
xfstests: fix xfs/205 for new log size defaults

test xfs/205 expects a certain log size, but defaults have
changed, the logs are bigger, and this test now fails w/ early
ENOSPC:

     QA output created by 205
    +   !!! disk full (expected)
    +   !!! disk full (expected)
    +   !!! disk full (expected)
     *** one file
    +   !!! disk full (expected)
     *** one file, a few bytes at a time
     ...

Fix this by specifying the log size at mkfs time, so freespace is
as the test expects it to be.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: an regression test for btrfs balance
Gui Hecheng [Wed, 9 Oct 2013 02:16:01 +0000 (02:16 +0000)]
xfstests: an regression test for btrfs balance

Originally, when executing "btrfs balance" right after
"btrfs subvolume snaphot" & "btrfs subvolume delete",
a kernel BUG arises.

This problem is caused by the patch:
[PATCH 1/2] Btrfs: fix for patch "cleanup: don't check
the same thing twice"
The commit id: 48475471728f060bfd2e686f592ef208d3ba8b7d
(in kernel/git/torvalds/linux.git)

handled by the patch:
[PATCH 2/3] Btrfs: fix oops caused by the space balance
and dead roots

[rjohnston: change test number to 14]

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Incorrect check for gdbm/ndbm.h
Stanislav Kholmanskikh [Mon, 14 Oct 2013 15:01:39 +0000 (15:01 +0000)]
xfstests: Incorrect check for gdbm/ndbm.h

Current version of AC_PACKAGE_WANT_NDBM has following bugs:
* a typo (',') next to 'gdbm/ndbm.h', so C compiler fails
  with a syntax error when trying to compile
  "#include <gdbm/ndbm.h,>"

* autoconf never defines HAVE_GDBM_NDBM_H_ because it
  converts both header names (gdbm/ndbm.h, gdbm-ndbm.h)
  to GDBM_NDBM_H

Because of these bugs 'dbtest' can't be compiled on systems where
'gdbm-ndbm.h' header is absent but 'gdbm/ndbm.h' is present.

Fixed this.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: handle xfs_quota output w/ long devicenames
Eric Sandeen [Sun, 6 Oct 2013 22:46:19 +0000 (22:46 +0000)]
xfstests: handle xfs_quota output w/ long devicenames

Long device names may be split onto their own line
on quota output:

Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
/dev/mapper/my-very-very-very-long-devicename
                48M      0      0  00 [------] /mnt/scratch

which breaks tests that capture quota output - currently,
only xfs/108.

Add a _filter_quota() which fixes this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add filter to 200 accommodate changed mount output
Eric Sandeen [Sun, 6 Oct 2013 21:28:01 +0000 (21:28 +0000)]
xfstests: add filter to 200 accommodate changed mount output

The mount binary changed its output w.r.t. red-only devices, and
stopped referring to a "block device."

This broke at least test xfs/200; add a common filter to remove
the "block device" from older mount binary output, and change
the 200.out file to match.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: mkfs scratch device in generic/294
Eric Sandeen [Sun, 6 Oct 2013 20:42:31 +0000 (20:42 +0000)]
xfstests: mkfs scratch device in generic/294

test 294 is using the scratch device w/o mkfs-ing it first,
this runs the risk of following a test which completely
fills the fs, causing 294 to fail.

add "rm -f $seqres.full" as well, it was growing on every run.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: restrict 259 device sizes to multiples of 512
Eric Sandeen [Sun, 6 Oct 2013 02:40:00 +0000 (02:40 +0000)]
xfstests: restrict 259 device sizes to multiples of 512

Test 259 tries to make a loop device size which is 1 byte less
than 4T; losetup now warns that this makes little sense, and
the warning breaks the test output:

    +losetup: /mnt/test/259.image: warning: file does not fit into a 512-byte sector the end of the file will be ignored.

The RH QE testcase did originally use loopback, so did
not in effect test anything other than 512-multiple boundaries.

Just drop the non-512-byte-multiple cases, they produce
devices exactly the same size as their 512-byte-multiple
neighbors.

(FWIW, this is a regression test for the bug that
d943b11 mkfs: get size of device properly
fixed.)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests generic/260: get correct trimmed bytes
Eryu Guan [Fri, 4 Oct 2013 06:32:56 +0000 (06:32 +0000)]
xfstests generic/260: get correct trimmed bytes

Starting from util-linux v2.23 fstrim(1) reports trimmed bytes
differently, e.g.

new fstrim: /mnt/ext4: 9.7 GiB (10411118592 bytes) trimmed
old fstrim: /mnt/ext4: 10411118592 bytes were trimmed

generic/260 reports syntax error

    +./tests/generic/260: line 111: [: 9.7: integer expression expected
    +./tests/generic/260: line 121: [: 9.7: integer expression expected
    +./tests/generic/260: line 183: [: 9.7: integer expression expected

Add a new filter called _filter_fstrim in common/filter and get the
correct trimmed bytes in generic/260, so the test passes with both old
and new fstrim.

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: btrfs/013 regression test for prealloc with balance
Josef Bacik [Fri, 27 Sep 2013 14:27:33 +0000 (14:27 +0000)]
xfstests: btrfs/013 regression test for prealloc with balance

We had a regression where we were not copying csums properly when balancing a
prealloc extent.  Unfortunately the way this showed up the most was with the
csum simply missing, which doesn't result in an error to userspace.  So I've
copied what generic/310 does and check dmesg for csum errors when the test
starts and then compare that count to the csum errors after the test finishes to
see if there was a problem.  This approach caught the error without my fix, and
then passed fine with my fix in place but with the previous errors still in
dmesg.  Thanks,

[rjohnston: changed test number to 13]

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add xfs/291 to auto group
Eric Sandeen [Thu, 26 Sep 2013 14:14:08 +0000 (14:14 +0000)]
xfstests: add xfs/291 to auto group

291 passes just fine w/ current xfsprogs on non-crc filesystems,
so add it to the auto group.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: unify apostrophes in output files
Tomas Racek [Thu, 19 Sep 2013 16:20:37 +0000 (16:20 +0000)]
xfstests: unify apostrophes in output files

With coreutils v8.16 the style of apostrophes changed from `word' to
'word'. This is breaking some tests which use the older form.

This commit introduces function changes the golden output of the
affected tests and introduces a filter for the older style output.

[dchinner: modified to use a global filter in check rather than
per-test filters]
[rjohnston: minor comment change]

Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix set-default test in btrfs/001
Josef Bacik [Wed, 18 Sep 2013 20:48:27 +0000 (20:48 +0000)]
xfstests: fix set-default test in btrfs/001

We were actually testing this improperly, there was a bug in the set default
code so we weren't actually honoring the 0 subvolid properly.  To fix this we
need to get the subvolid for the subvol we want to set as the default and use
that in the command.  With this patch we now pass again with the fix for the 0
subvolid.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Tested-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: check for valid input to _scratch_mkfs_sized
Eric Sandeen [Tue, 17 Sep 2013 19:30:41 +0000 (19:30 +0000)]
xfstests: check for valid input to _scratch_mkfs_sized

_scratch_mkfs_sized requires an integer number of bytes
as input; if it's given something else, catch it and _notrun.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Refactor code for obtaining test list
Lukas Czerner [Thu, 11 Jul 2013 10:37:58 +0000 (10:37 +0000)]
xfstests: Refactor code for obtaining test list

Put the code for obtaining the list of test into one place which makes
things more readable. It will also allow us to re-init the list in the
future if we need it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Run all tests when nothing is specified
Lukas Czerner [Thu, 11 Jul 2013 10:37:56 +0000 (10:37 +0000)]
xfstests: Run all tests when nothing is specified

Currently when no tests or test groups are specified xfstests will
silently test nothing. Interestingly enough when test groups to exclude
are specified the rest of the tests will be run.

This commit changes that to run all possible tests (for a given file
system) when no specific tests has been specified. This matches the old
xfstests behaviour.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix fsstress usage() output
Eric Sandeen [Mon, 16 Sep 2013 22:00:37 +0000 (22:00 +0000)]
xfstests: fix fsstress usage() output

The show_ops() output should come as part of the -f option
help.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/011 improvement for compressed filesystems
Stefan Behrens [Fri, 13 Sep 2013 10:27:21 +0000 (10:27 +0000)]
xfstests: btrfs/011 improvement for compressed filesystems

Josef noticed that using /dev/zero to generate most of the test
data doesn't work if someone overrides the mount options to
enable compression. The test that performs a cancellation failed
because the replace operation was already finished when the
cancel request was executed.

Since /dev/urandom is too slow to generate multiple GB, the
way how the filesystem data is generated is completely changed
with this patch. Now /dev/urandom is used to generate one 1MB
file and this file is copied up to 2048 times. /dev/zero is no
longer used.

The runtime of the test is about the same as before. Compression
works now, online duplication will again cause issues, but
we don't have online duplication today.

Reported-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Jan Schmidt <list.xfs@jan-o-sch.net>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Make 204 work with different block and inode sizes.
Dave Chinner [Tue, 3 Sep 2013 00:14:55 +0000 (00:14 +0000)]
xfstests: Make 204 work with different block and inode sizes.

Otherwise it fails with ENOSPC on CRC enabled filesystems because
of the larger inode size.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Obey mkfs options for sized filesystems on XFS
Dave Chinner [Tue, 3 Sep 2013 00:14:54 +0000 (00:14 +0000)]
xfstests: Obey mkfs options for sized filesystems on XFS

The XFS implementation of _scratch_mkfs_sized ignores MKFS_OPTIONS
when a custom block size is set and so isn't testing things like
CRCs on such sized filesytsems. Fix this by ensuring we don't try to
override the block size is it is set in MKFS_OPTIONS. xfs/204 shows
this problem.

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 agoxfstests: generic/204 should call _check_scratch_fs
Dave Chinner [Tue, 3 Sep 2013 00:14:53 +0000 (00:14 +0000)]
xfstests: generic/204 should call _check_scratch_fs

Because if it corrupts the filesystem it currently goes undetected.

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 agoxfstests btrfs/012: test btrfs-convert
Eric Sandeen [Sun, 4 Aug 2013 20:12:31 +0000 (20:12 +0000)]
xfstests btrfs/012: test btrfs-convert

Turns out btrfs-convert broke on July 3, and lo! we
do not have a regression test, and now we have one,
and there was much rejoicing.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: _test_generic_punch: Obtain block size from $TEST_DIR
chandan [Wed, 28 Aug 2013 06:24:10 +0000 (06:24 +0000)]
xfstests: _test_generic_punch: Obtain block size from $TEST_DIR

The current code incorrectly gets block size information from $TEST_DEV
instead of from $TEST_DIR. This returns the block size of the filesystem
hosting the device file rather than that of the filesystem on $TEST_DEV.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: update _filter_size() for Btrfs
Stefan Behrens [Fri, 23 Aug 2013 13:07:12 +0000 (13:07 +0000)]
xfstests: update _filter_size() for Btrfs

The btrfs-progs tools changed the output:
- 100GiB instead of 100GB

xfstest btrfs/006 is one that failed due to this change.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add a test for btrfs device replace operation
Stefan Behrens [Fri, 23 Aug 2013 13:07:11 +0000 (13:07 +0000)]
xfstests: add a test for btrfs device replace operation

This test performs btrfs device replace tests with all possible profiles
(single/dup/mixed/raid0/raid1/raid10), one round with the '-r' option
to 'btrfs replace start' and one round without this option. The
cancelation is tested only once and with the dup/single profile for
metadata/data.

This test takes 181 seconds on my SSD equiped test box and 237s on
spinning disks. Almost all the time is spent when the filesystem is
populated with test data. The replace operation itself takes less than
a second for all the tests, except for the test that is marked as
'thorough' which will run for about 8 seconds on my test box.

The amount of tests done depends on the number of devices in the
SCRATCH_DEV_POOL. For full test coverage, at least 5 devices should
be available (e.g. 5 partitions). With less than 2 entries in
SCRATCH_DEV_POOL, the test is not executed.

The source and target devices for the replace operation are arbitrarily
chosen out of SCRATCH_DEV_POOl. Since the target device mustn't be
smaller than the source device, the requirement for this test is that
all devices have _exactly_ the same size. If this is not the case, the
test terminates with _notrun.

To check the filesystems after replacing a device, a scrub run is
performed, a btrfsck run, and finally the filesystem is remounted.

This commit depends on my other commit:
"xfstest: don't remove the two first devices from SCRATCH_DEV_POOL"

[rjohnston: renumbered to btrfs/011]

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: fix btrfs/006 for 10+ devices in SCRATCH_DEV_POOL
Stefan Behrens [Fri, 23 Aug 2013 13:07:13 +0000 (13:07 +0000)]
xfstests: fix btrfs/006 for 10+ devices in SCRATCH_DEV_POOL

One problem was the output of "uniq -c" which added spaces depending
on the size of the count value (e.g. one space less for 10+ devices).

The second problem was that "btrfs fi show" was doing the same:
"devid %4llu size %s used %s path %s".

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: don't remove the two first devices from SCRATCH_DEV_POOL
Stefan Behrens [Fri, 23 Aug 2013 13:07:10 +0000 (13:07 +0000)]
xfstests: don't remove the two first devices from SCRATCH_DEV_POOL

Since common/config is executed twice, if SCRATCH_DEV_POOL is configured
via the environment, the current code removes the first device entry twice
which means that you lose the second device for the test.

The fix is to not remove anything from SCRATCH_DEV_POOL anymore.
That used to be done (I can only guess) to allow to pass the
SCRATCH_DEV_POOL as an argument to _scratch_mkfs. Since _scratch_mkfs adds
the SCRATCH_DEV, the pool mustn't contain that device anymore.

A new function _scratch_pool_mkfs is introduced that does the expected
thing.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Test all 3 quotas simultaneously.
Chandra Seetharaman [Thu, 1 Aug 2013 19:52:26 +0000 (19:52 +0000)]
xfstests: Test all 3 quotas simultaneously.

Add a test for testing all 3 (user, group and project) quotas together.

This is a modified version of xfstest 050.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests/btrfs/010: add snapshot-aware defrag for partial extents testcases
Liu Bo [Thu, 25 Jul 2013 08:15:02 +0000 (08:15 +0000)]
xfstests/btrfs/010: add snapshot-aware defrag for partial extents testcases

This is to test whether snapshot-aware defrag can work well on partial extents.

Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/009 never shrinked or removed $seqres.full
Stefan Behrens [Fri, 16 Aug 2013 17:44:54 +0000 (17:44 +0000)]
xfstests: btrfs/009 never shrinked or removed $seqres.full

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests generic/318: user namespace uid/gids in an ACL
Dwight Engen [Mon, 19 Aug 2013 17:34:42 +0000 (17:34 +0000)]
xfstests generic/318: user namespace uid/gids in an ACL

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests generic/317: user namespace uid/gids in an inode
Dwight Engen [Thu, 27 Jun 2013 16:03:34 +0000 (16:03 +0000)]
xfstests generic/317: user namespace uid/gids in an inode

[rjohnston: renumbered test to 317]

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: <rjohnston@sgi.com>
Signed-off-by: <rjohnston@sgi.com>
10 years agoxfstests: add nsexec user namespace helper
Dwight Engen [Thu, 27 Jun 2013 16:03:28 +0000 (16:03 +0000)]
xfstests: add nsexec user namespace helper

Add new program nsexec to facilitate creating/entering a user namespace. The
original source for the program is https://lwn.net/Articles/539940. I added
the -s option to become "root" in the user namespace.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: <rjohnston@sgi.com>
Signed-off-by: <rjohnston@sgi.com>
10 years agoxfstests: redirect output in btrfs/003
Stefan Behrens [Fri, 16 Aug 2013 15:18:43 +0000 (15:18 +0000)]
xfstests: redirect output in btrfs/003

This test failed for me with output from 'btrfs balance':
     QA output created by 003
    +Done, had to relocate 4 out of 4 chunks
    +Done, had to relocate 5 out of 5 chunks
     Silence is golden

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Allow to specify RESULT_BASE directory
Lukas Czerner [Thu, 11 Jul 2013 10:38:01 +0000 (10:38 +0000)]
xfstests: Allow to specify RESULT_BASE directory

This commit adds the possibility to specify RESULT_BASE directory from
the config file, or with environment variable. The default remains the
same "$here/results/".

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Allow to re-read configuration
Lukas Czerner [Thu, 11 Jul 2013 10:38:00 +0000 (10:38 +0000)]
xfstests: Allow to re-read configuration

Move configuration initialization into a function so we can re-read it
without the need to reinclude the common/config file which would be
ugly. This is in preparation for adding support for sections into config
files.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Allow to recheck options in common/rc
Lukas Czerner [Thu, 11 Jul 2013 10:37:59 +0000 (10:37 +0000)]
xfstests: Allow to recheck options in common/rc

Move configuration checks into separate function to allow us to recheck
the options without the need to reinclude the whole source file which is
ugly. We still run the check on include.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: Export all important variables in common/config
Lukas Czerner [Thu, 11 Jul 2013 10:37:57 +0000 (10:37 +0000)]
xfstests: Export all important variables in common/config

Currently we do not export some of the important variables in
common/config. Fix this.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: add a new test case for ext4 indirect-based file
Zheng Liu [Fri, 16 Aug 2013 05:28:07 +0000 (05:28 +0000)]
xfstests: add a new test case for ext4 indirect-based file

After applied this commit (864688d3), xfstests #255 will not test a
file system that cannot support fallocate(2), such as a indirect-based
file in ext4.  So we need to add a new generic test case to test it.

The difference between #255 and this test case is only to use pwrite to
allocate blocks.  Other filesystems should survive in this test case.
In the mean time, a new argument '-u' is added into _test_generic_punch
not to run unwritten tests.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoContent-Type: text/plain; charset="utf-8"
Josef Bacik [Tue, 2 Jul 2013 19:17:18 +0000 (19:17 +0000)]
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: xfstests: make the scratch device for generic/256 slightly larger
Date: Tue, 02 Jul 2013 19:17:18 -0000
From: Josef Bacik <jbacik@fusionio.com>
X-Patchwork-Id: 5816
Message-Id: <1372792638-23957-1-git-send-email-jbacik@fusionio.com>
To: <linux-btrfs@vger.kernel.org>, <xfs@oss.sgi.com>

This is similar to a previous fix I sent.  1 gig makes us do mixed file block
groups for btrfs, so these enospc tests will usually fail because we don't have
space for metadata, which is the case for this test.  So jack the size up to
1.5gig so that btrfs can do its normal thing and pass the test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: fix _mount_ops_filter() to support $TEST_DIR containing -o
Koen De Wit [Tue, 2 Jul 2013 21:44:57 +0000 (21:44 +0000)]
xfstests: fix _mount_ops_filter() to support $TEST_DIR containing -o

If multiple mount options are given with multiple -o parameters,
_mount_ops_filter concatenates them by replacing all -o's with a comma
(except for the first -o).

If $TEST_DIR contains "-o" (e.g. /mnt/test-os/) you get errors like this:

   # ./check generic/002
     mount: mount point /mnt/test,s/ does not exist
     common/rc: retrying test device mount with external set
     mount: mount point /mnt/test,s/ does not exist
     common/rc: could not mount /dev/sdc3 on /mnt/test-os/

Fix it by only replacing -o's that are preceded by at least one space.

Signed-off-by: Koen De Wit <koen.de.wit@oracle.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: btrfs/009: regression test for subvol delete
Josef Bacik [Wed, 14 Aug 2013 20:07:52 +0000 (20:07 +0000)]
xfstests: btrfs/009: regression test for subvol delete

We were allowing users to delete their default subvolume, which is problematic.
This test is a regression test to make sure we don't let that happen in the
future.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston: renumbered test from 003 to 009]

10 years agoxfstests: btrfs/008, another send regression test
Josef Bacik [Mon, 12 Aug 2013 19:13:22 +0000 (19:13 +0000)]
xfstests: btrfs/008, another send regression test

This is a regression test for a problem we had where we'd assume we had created
a directory if it only had subvols inside of it.  This was happening because
subvols would have lower inode numbers than our current send progress because
their inode numbers are based off of a different counter.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston: renumbered test from 002 to 008]

10 years agoxfstests btrfs/007: test send / receive
Jan Schmidt [Tue, 13 Aug 2013 17:24:18 +0000 (17:24 +0000)]
xfstests btrfs/007: test send / receive

Basic send / receive functionality test for btrfs. Requires current
version of fsstress built (-x support). Relies on fssum tool but can
skip the test if it failed to build.

Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
Reviewed-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
[rjohnston: renumbered test from 316 to 007]

10 years agoxfstests: add fssum tool
Jan Schmidt [Tue, 13 Aug 2013 17:24:17 +0000 (17:24 +0000)]
xfstests: add fssum tool

fssum is a tool to build a recursive checksum for a file system. The home
repository of fssum is

    git://git.kernel.org/pub/scm/linux/kernel/git/arne/far-progs.git

Signed-off-by: Jan Schmidt <list.xfs@jan-o-sch.net>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: renumber existing btrfs tests to start with 1
David Sterba [Tue, 13 Aug 2013 21:16:27 +0000 (16:16 -0500)]
xfstests: renumber existing btrfs tests to start with 1

Current numbering is inheried from the single testsuite series. There
are only 6 btrfs-specific tests and it makes more sense to start adding
new ones at a more natural place than 300-something. There's no overlap
with the old and new numbers and I hope there' will be no confusion when
referencing them.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
10 years agoxfstests: generic/315: allow a little tolerance for our used check
Josef Bacik [Mon, 29 Jul 2013 18:55:56 +0000 (14:55 -0400)]
xfstests: generic/315: allow a little tolerance for our used check

So df in btrfs is tricky at best, and relying on it for accurate information is
not great, but it's the best way to verify this test.  To get around btrfs being
inconsistent sometimes just use _within_tolerance to check our new df value to
make sure that our truncate did something.  With this patch I no longer see
transient failures of this test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: generic/314 filter out total from ls -l output
Josef Bacik [Fri, 26 Jul 2013 15:45:32 +0000 (11:45 -0400)]
xfstests: generic/314 filter out total from ls -l output

ls -l will show the nblocks for the directory, and this made it into the golden
output for 314.  The problem is nblocks is 0 for btrfs directories because we're
awesome, which makes us fail this test.  So filter out the "total blah" line of
ls -l so btrfs can pass this test too.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoRevert "xfstests: exit out if _scratch_mount fails"
Ben Myers [Fri, 26 Jul 2013 16:07:33 +0000 (11:07 -0500)]
Revert "xfstests: exit out if _scratch_mount fails"

This reverts commit 74bcf51c066e498a147ab5902e377efa59224dd3.

Unfortunately this commit causes dmapi tests to be run on systems which
don't have dmapi installed, so they fail.

Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: generic/315, verify preallocated disk space is released per truncate
Jie Liu [Mon, 1 Jul 2013 10:29:19 +0000 (18:29 +0800)]
xfstests: generic/315, verify preallocated disk space is released per truncate

Introduce generic test 315 to verify if the disk space is
released after truncating a preallocated file back to the
old smaller size.  Before Linux-3.10, Btrfs/OCFS2 test
failed in this case.

The test file is fallocated with FALLOC_FL_KEEP_SIZE option.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: clean up remake related matters from README
Jie Liu [Mon, 1 Jul 2013 10:37:19 +0000 (18:37 +0800)]
xfstests: clean up remake related matters from README

Cleanup 'remake' related matters from the README file as the
remake utility has already been removed by:

commit 609d17c4eb911891fae3c0081c2cd1caa613c0de

xfstests: remove remake script

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: skip generic/192 if noatime is set
David Sterba [Wed, 3 Jul 2013 14:00:05 +0000 (16:00 +0200)]
xfstests: skip generic/192 if noatime is set

Test generic/192 fails if noatime is set

generic/192
    -delta1 - access time after sleep in-core: 40
    -delta2 - access time after sleep on-disk: 40
    +delta1 - access time after sleep in-core: 0
    +delta2 - access time after sleep on-disk: 0

but it's pointless to test atime effects with noatime.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: exit out if _scratch_mount fails
Josef Bacik [Tue, 9 Jul 2013 19:07:27 +0000 (15:07 -0400)]
xfstests: exit out if _scratch_mount fails

I test some of the different mkfs options for btrfs, one set doesn't work
properly with small file systems, so the fs won't mount.  This is fine from a
btrfs point of view, but tests that fail to mount the scratch fs will run
anyway, so if it's a "fill the fs" sort of test this will wreak havoc.  To fix
this just error out of _scratch_mount fails.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: generic/314, test sgid inheritance on subdirs
Carlos Maiolino [Fri, 12 Jul 2013 19:46:13 +0000 (16:46 -0300)]
xfstests: generic/314, test sgid inheritance on subdirs

Tests if subdirectories created on the filesystem will properly inherit sgid bit
when this is set on the parent directory, once the process has the properly
permissions to create a subdirectory, this, should inherit parent's sgid bit if
this is set and irix_sgid_inherit sysctl is disabled.

V2: add missing source of "attr" file for _require_acls

V3: use _ls_l to filter out the selinux "."
    renumber to 314 to make the merge easier

V4: fix 314.out to the correct output

Thanks to Sandeen who have written this patch

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstest: ensure small symlink is removed
Mark Tinguely [Tue, 18 Jun 2013 01:35:05 +0000 (20:35 -0500)]
xfstest: ensure small symlink is removed

Tests the XFS symlinks that are small enough to be in the
inode, but were move to a remote symlink due to an extended
attribute were correctly removed.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: fix README, FSTYP options
Dwight Engen [Thu, 27 Jun 2013 15:57:36 +0000 (11:57 -0400)]
xfstests: fix README, FSTYP options

commit cbcc88fb changed test selection to use shell globs, so fixup the
examples given in the README file.

remove options for FSTYP other than NFS since the FSTYP will be automatically
detected (on Linux) from $TEST_DEV.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests generic/313: test ctime and mtime are updated on truncate and ftruncate
Eryu Guan [Thu, 27 Jun 2013 15:32:10 +0000 (23:32 +0800)]
xfstests generic/313: test ctime and mtime are updated on truncate and ftruncate

Regression test for commit:
3972f26 btrfs: update timestamps on truncate()

Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: use xfs_io fiemap instead of filefrag V2
Josef Bacik [Mon, 24 Jun 2013 14:21:36 +0000 (10:21 -0400)]
xfstests: use xfs_io fiemap instead of filefrag V2

Btrfs has always failed shared/218 because of the way we allocate extents on
disk.  The last part of 218 writes contiguously holey from the start of the file
forward, which for btrfs means we get 16 extents but they are physically
contigous.  filefrag -v shows all 16 extents, but prints out that there is 1
extent, because they are physically contiguous.  This isn't quite right and
makes the test fail.  So instead of using filefrag use xfs_io -c fiemap which
will print the whole map and then get the count from there.  With this patch
btrfs now passes the test, I also verified that ext4 and xfs still pass this
test.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: .gitignore: add fsync-tester
Dwight Engen [Tue, 25 Jun 2013 19:34:35 +0000 (15:34 -0400)]
xfstests: .gitignore: add fsync-tester

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
[bpm: fixed alphabetization]

10 years agoxfstests: aio-stress is calling pthread_join incorrectly
Dave Kleikamp [Tue, 18 Jun 2013 22:57:00 +0000 (17:57 -0500)]
xfstests: aio-stress is calling pthread_join incorrectly

The retval parameter to pthread_join() is a pointer to a pointer.
aio-stress is passing in a pointer to an int. This can result in a bus
error on sparc64 when the pointer is not aligned on a 64-bit boundary.
Since the return value is not used, it is simplest to pass a NULL
pointer instead.

This has been fixed in the LTP source:
https://github.com/linux-test-project/ltp/commit/981d33aad3b33c4625b88990fbf2fad5470d47e0

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
10 years agoxfstests: fsync-tester: fix pwrite() return check and disable direct for test 19
Josef Bacik [Wed, 12 Jun 2013 01:13:03 +0000 (21:13 -0400)]
xfstests: fsync-tester: fix pwrite() return check and disable direct for test 19

Test 19 in direct mode was failing on xfs because it was not actually doing the
write because the writes were not sectorsize aligned.  This test is to test
btrfs's inline extent fsync()ing so the writes won't be sectorsize aligned, and
inline extents will fall back to buffered anyway so direct mode is meaningless
for this test.  So just check if we are test 19 and disable direct mode so we
don't have to change the golden output.  Also change test_five() to compare
against a ssize_t instead of a size_t since apparently comparing against size_t
makes it cast the return value of pwrite() to size_t which screws up the error
case, so instead of seeing the pwrite() error on xfs which would have explained
this all it appeared as if it was succeeding and screwing up the fsync(), which
unfortunately wasted a bit of Daves time.  This patch should fix all this up.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>