xfstests-dev.git
7 years agoext4/004: limit the amount of data written so test runs faster
Theodore Ts'o [Wed, 24 Dec 2014 03:53:10 +0000 (14:53 +1100)]
ext4/004: limit the amount of data written so test runs faster

Previously this test was taking 6-7 minutes, and writing half a
gigabyte of data in the dump/restore test directory.  Change this to
be about 60 megs, and to take ~20 seconds.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocheck: treat _check_{test,scratch}_fs failures as test failures
Eryu Guan [Wed, 24 Dec 2014 03:51:50 +0000 (14:51 +1100)]
check: treat _check_{test,scratch}_fs failures as test failures

Currently if _check_test_fs and/or _check_scratch_fs find corruption,
the test itself is still reported as pass, like

[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch

xfs/071  2s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full)
xfs/072  1s
Ran: xfs/071 xfs/072
Passed all 2 tests

[root@hp-dl388eg8-01 xfstests]# echo $?
0

Usually it's not a problem, but it does confuse scripts that depend on
return value of check. Update check to treat _check_{test,scratch}_fs
failures as test failures too, new test output is like

[root@hp-dl388eg8-01 xfstests]# ./check xfs/071 xfs/072
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl388eg8-01 3.18.0-rc7+
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch

xfs/071 2s ... 2s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/071.full)
xfs/072 1s ... 1s
Ran: xfs/071 xfs/072
Failures: xfs/071
Failed 1 of 2 tests

[root@hp-dl388eg8-01 xfstests]# echo $?
1

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: return failure if _check_xxx_filesystem find corruption
Eryu Guan [Wed, 24 Dec 2014 03:51:25 +0000 (14:51 +1100)]
common: return failure if _check_xxx_filesystem find corruption

So the callers could know if these functions find corruptions by the
return value.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: exit only if tests find corruption
Eryu Guan [Wed, 24 Dec 2014 03:51:04 +0000 (14:51 +1100)]
common: exit only if tests find corruption

If _check_xxx_filesystem called by tests when corruption found
they exit, but we don't want the calls from the test harness itself to
exit when corruption is found.

_check_xfs_filesystem already behaves correctly, make
_check_generic_filesystem and _check_btrfs_filesystem follow the same
behavior.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add test case for qgroup account on shared extents
Liu Bo [Wed, 24 Dec 2014 03:48:23 +0000 (14:48 +1100)]
btrfs: add test case for qgroup account on shared extents

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
it's used to verify that removing shared extents can end up incorrect
qgroup accounting.

It can produce qgroup related warnings.

The fix is https://patchwork.kernel.org/patch/5499981/
"Btrfs: fix a warning of qgroup account on shared extents"

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoCheck O_DIRECT support before testing direct I/O
Junho Ryu [Tue, 16 Dec 2014 03:01:06 +0000 (14:01 +1100)]
Check O_DIRECT support before testing direct I/O

Some filesystems do not support O_DIRECT.  Check whether TEST_DIR supports
it by running xfs_io with -d flag.

Signed-off-by: Junho Ryu <jayr@google.com>
Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/038: require fallocate support
Dushan Tcholich [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
generic/038: require fallocate support

Add test for fallocate(2) support

Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: unify _require_batched_discard
Dushan Tcholich [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
common: unify _require_batched_discard

To check for FITRIM tests used  _require_fstrim() and
_test_batched_discard() but as _test_batched_discard() already
includes _test_fstrim() unify FSTRIM check throughout xfstests with
_require_batched_discard().

Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4/308: require fallocate support
Theodore Ts'o [Mon, 15 Dec 2014 23:53:57 +0000 (10:53 +1100)]
ext4/308: require fallocate support

These tests use the falloc command in xfs_io, and there are some file
systems (ext3) or file system configurations (ext4 in ext3
compatibility mode) which do not support fallocate.  So add the
explicit requirement to avoid false test failures.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add regression test for clone ioctl
Filipe Manana [Mon, 15 Dec 2014 23:53:42 +0000 (10:53 +1100)]
btrfs: add regression test for clone ioctl

Regression test for a btrfs clone ioctl issue where races between
a clone operation and concurrent target file reads would result in
leaving stale data in the page cache. After the clone operation
finished, reading from the clone target file would return the old
and no longer valid data. This affected only buffered reads (i.e.
didn't affect direct IO reads).

This issue was fixed by the following linux kernel patch:

    Btrfs: ensure readers see new data after a clone operation
    (commit c125b8bff1d9f6c8c91ce4eb8bd5616058c7d510)

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofstests: btrfs, add test for snapshoting after file write + truncate
Filipe Manana [Mon, 15 Dec 2014 23:50:56 +0000 (10:50 +1100)]
fstests: btrfs, add test for snapshoting after file write + truncate

Regression test for a btrfs issue where if right after the snapshot
creation ioctl started, a file write followed by a file truncate
happened, with both operations increasing the file's size, the created
snapshot would capture an inconsistent state of the file system tree.
That state reflected the file truncation but it didn't reflect the
write operation, and left a gap between two file extent items (and
that gap corresponded to the total or a partial area of the write
operation's range).

This issue was fixed by the following linux kernel patch:

    Btrfs: fix snapshot inconsistency after a file write followed by truncate

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: use mke2fs -F instead of piping in yes
Theodore Ts'o [Mon, 15 Dec 2014 23:50:21 +0000 (10:50 +1100)]
common: use mke2fs -F instead of piping in yes

It's possible based on a race conditions (and possibly the version of
coreutils which supplies /usr/bin/yes) that commands of the form:

yes | $MKFS_PROG ...

will end up causing the following failure:

shared/298 16s ... [23:49:03] [23:49:19] - output mismatch (see /results/results-4k/shared/298.out.bad)
    --- tests/shared/298.out 2014-10-31 10:13:04.000000000 -0400
    +++ /results/results-4k/shared/298.out.bad 2014-11-29 23:49:19.118138099 -0500
    @@ -1,4 +1,6 @@
     QA output created by 298
    +yes: standard output: Broken pipe
    +yes: write error
     Generating garbage on loop...done.
     Running fstrim...done.
     Detecting interesting holes in image...done.
    ...
    (Run 'diff -u tests/shared/298.out /results/results-4k/shared/298.out.bad'  to see the entire diff)

Using mke2fs's -F option instad of "yes | $MKFS_PROG" fixes this issue.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/299: make sure fio really exits
Eryu Guan [Mon, 15 Dec 2014 23:49:57 +0000 (10:49 +1100)]
generic/299: make sure fio really exits

Fix two problems in generic/299

1. Remove $seqres.full before test, otherwise the file is growing all
the time.

2. Make sure fio really exits, otherwise fio would block umount. $pid is
the pid of function run_check not fio, sometimes fio is still there when
$pid is dead and blocking umount.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocifs: add missing Makefile
David Disseldorp [Mon, 15 Dec 2014 23:48:51 +0000 (10:48 +1100)]
cifs: add missing Makefile

This fixes the make install target, which traverses all tests/*
subdirectories.

Reported-by: David Drysdale <drysdale@google.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add groups for btrfs tests
Eryu Guan [Mon, 15 Dec 2014 23:48:35 +0000 (10:48 +1100)]
btrfs: add groups for btrfs tests

Some new btrfs groups have been added in the btrfs stress patchset, add
other tests to proper groups too.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: the _require checks for bigalloc need a larger fs size
Vishal Verma [Fri, 12 Dec 2014 00:26:56 +0000 (11:26 +1100)]
ext4: the _require checks for bigalloc need a larger fs size

_require_ext4_bigalloc and _require_ext4_mkfs_bigalloc create a
200k fs. DAX (as XIP before it) relies on a fs block size ==
system page size; ie 4k for us.  With a 200k fs size limit,
mkfs refuses to create a filesystem with a 4k block size, so
the check fails, but for a bogus reason.
Increasing the fs size to 512m allows mkfs to create a filesystem
with 4k block size, so the test passes.

Signed-off-by: Vishal Verma <vishal.l.verma@linux.intel.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: fix comment about _require_test
Eryu Guan [Fri, 12 Dec 2014 00:26:45 +0000 (11:26 +1100)]
common: fix comment about _require_test

_require_test will mount test dev if not mounted, fix the comment to
reflect that.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs/017: remove duplicate test
Eryu Guan [Fri, 12 Dec 2014 00:26:31 +0000 (11:26 +1100)]
btrfs/017: remove duplicate test

btrfs/017 is same as btrfs/015, remove it.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofstests: change mode of test files to 0755
Eryu Guan [Fri, 12 Dec 2014 00:26:15 +0000 (11:26 +1100)]
fstests: change mode of test files to 0755

Performed by

find tests -perm 644 -name [0-9][0-9][0-9] -exec chmod 755 {} \;

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/071: remove xfs/071.out from git
Eryu Guan [Fri, 12 Dec 2014 00:25:47 +0000 (11:25 +1100)]
xfs/071: remove xfs/071.out from git

xfs/071.out is supposed to linked to the right out file at run time.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocifs: add server-side copy sanity test
David Disseldorp [Fri, 12 Dec 2014 00:24:10 +0000 (11:24 +1100)]
cifs: add server-side copy sanity test

This test uses the cloner binary to issue CIFS_IOC_COPYCHUNK_FILE
server-side copy requests.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Acked-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: rename _require_btrfs_cloner to _require_cloner
David Disseldorp [Fri, 12 Dec 2014 00:23:06 +0000 (11:23 +1100)]
common: rename _require_btrfs_cloner to _require_cloner

src/cloner.c is no longer Btrfs specific, so use a generic name.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Acked-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add test to stress chunk allocation/removal and fstrim
Filipe Manana [Fri, 12 Dec 2014 00:07:22 +0000 (11:07 +1100)]
btrfs: add test to stress chunk allocation/removal and fstrim

Stress btrfs' block group allocation and deallocation while running
fstrim in parallel. Part of the goal is also to get data block groups
deallocated so that new metadata block groups, using the same physical
device space ranges, get allocated while fstrim is running. This caused
several issues ranging from invalid memory accesses, kernel crashes,
metadata or data corruption, free space cache inconsistencies, free
space leaks and memory leaks.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: add dump/restore test
Xiaoguang Wang [Thu, 11 Dec 2014 23:56:26 +0000 (10:56 +1100)]
ext4: add dump/restore test

This test case will first use fsstress to fill a file system, then
dump it to standard output and restore it from standard input, finally
check that the original contents and the new contents generated by
restore tool will be same.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: update README to list build dependencies
Steve French [Thu, 11 Dec 2014 23:55:29 +0000 (10:55 +1100)]
common: update README to list build dependencies

Add sample list of packages (dependencies) required to build XFSTESTS
and add a step to the instructions to mention creating the test
user needed for some of the ACL tests.

Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: use xfs_io falloc, not fallocate
Eric Sandeen [Thu, 11 Dec 2014 23:55:24 +0000 (10:55 +1100)]
generic: use xfs_io falloc, not fallocate

generic/315 fails messily if the fallocate command isn't present.

generic/299 also uses "fallocate" and "truncate" binaries which may
not be present.

Switch both to use xfs_io, and we already have the _require for
that, because it's what every other test uses...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/096: strip log stripe warnings from mkfs.xfs
Dave Chinner [Thu, 11 Dec 2014 23:55:15 +0000 (10:55 +1100)]
xfs/096: strip log stripe warnings from mkfs.xfs

The warnings have been removed when stripe unit/width are too big
for the log stripe unit to be set. Hence add them to the mkfs.xfs
filter and strip them from golden output file so the test succeeds
on both new and old mfks binaries.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs: test xfs_copy for various sector and block sizes
Eric Sandeen [Thu, 11 Dec 2014 23:55:15 +0000 (10:55 +1100)]
xfs: test xfs_copy for various sector and block sizes

This tests xfs_copy, copying all combinations of sector
size and block size possible on the platform running the
test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: enable tests that require scratch device on CIFS
Eryu Guan [Thu, 11 Dec 2014 23:53:55 +0000 (10:53 +1100)]
common: enable tests that require scratch device on CIFS

Just like commit

76c5f3c common: re-enable tests that require scratch dev on NFS

Enable tests that require scratch device on CIFS too to get a better
test coverage.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: add test to verify xattr replace operations are atomic
Filipe Manana [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic: add test to verify xattr replace operations are atomic

This test verifies that replacing a xattr's value is an atomic
operation. This is motivated by an issue in btrfs where replacing
a xattr's value wasn't an atomic operation, it consisted of
removing the old value and then inserting the new value in a
btree. This made readers (getxattr and listxattrs) not getting
neither the old nor the new value during a short time window.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/062: verify bulkstat finds all inodes
Brian Foster [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
xfs/062: verify bulkstat finds all inodes

The bulkstat mechanism is used by xfsdump and other tools to index all
inodes allocated in a filesystem. Run some simple tests with varying
inode layouts and bulkstat batch sizes to verify bulkstat finds the
expected number of inodes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/277: add _require_attrs
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic/277: add _require_attrs

NFS doesn't support attr yet, add _require_attrs in generic/277 to
avoid failure when testing on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: use _scratch_mount helper in _require_relatime()
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: use _scratch_mount helper in _require_relatime()

Change the way how _require_relatime() mount $SCRATCH_DEV, use
_scratch_mount helper so $SCRATCH_DEV is mounted with selinux context,
to avoid "same superblock, different selinux context" failure.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: skip atime related tests on NFS
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
generic: skip atime related tests on NFS

From nfs(5) we can know that atime related mount options have no
effect on NFS mounts, so add _require_atime() helper to skip atime
tests on NFS

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: add _require_block_device() helper
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: add _require_block_device() helper

Add _require_block_device() helper and use it in _require_dm_flakey()
and generic/076.

_require_dm_flakey() assumes $SCRATCH_DEV is a block device, now it can
also be a NFS export.

generic/076 does "cat $SCRATCH_DEV" which will fail when testing on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: re-enable tests that require scratch dev on NFS
Eryu Guan [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: re-enable tests that require scratch dev on NFS

Commit c041421 ("xfstests: stop special casing nfs and udf")
disables tests requires scratch dev running on NFS. Add the
infrastructure needed to re-enable them to get a larger test
coverage on NFS.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: Fixes for testing NFS over IPv6
Anna Schumaker [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
common: Fixes for testing NFS over IPv6

When testing NFS over IPv6, the user may set a $TEST_DEV of the form
[fe80::42]:/export.  The use of square brackets surrounding the IPv6
address is an accepted convention, but grep and awk think that our IPv6
address is actually a regex and tries to evaluate it instead.  The
result is that xfstests reports our filesystem "is busy or already
mounted".

This patch fixes the IPv6 problem by telling awk and grep to treat
$TEST_DEV as a fixed string rather than a regex.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/068: fix expected output file for proper restore output
Eric Sandeen [Mon, 10 Nov 2014 07:06:23 +0000 (18:06 +1100)]
xfs/068: fix expected output file for proper restore output

Oh my, I did a very bad thing - I wrote a new test to
check for xfsdump regressions, but did not create the
.out file with a known-good kernel.

This matches output from older, stable kernels, and is the
proper expected output.  Sorry about that!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoaio: add regression test race between write and fcntl
Dmitry Monakhov [Mon, 10 Nov 2014 07:06:19 +0000 (18:06 +1100)]
aio: add regression test race between write and fcntl

perform AIO-DIO and fcntl(F_SETFL) concurently. Unaligned AIO likely
results in synchronization which makes the race window wider.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofstests: update 'new' script
Dmitry Monakhov [Mon, 10 Nov 2014 07:01:10 +0000 (18:01 +1100)]
fstests: update 'new' script

- Update script to support new test cheme tests/$fs_type/$TEST_IDX
- Try to use first unused ID

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoaio: fix memory corruption in aio-last-ref-held-by-io
Liu Bo [Mon, 10 Nov 2014 07:01:07 +0000 (18:01 +1100)]
aio: fix memory corruption in aio-last-ref-held-by-io

This's been detected by testing generic/323 on btrfs, it keeps
producing chaos of checksum errors.

It is because aio-last-ref-held-by-io uses a static buffer that is
been used repeatedly for every io_submit() call, but we'll issue
NUM_IOS(=16) io_sumbit() in a 'for' loop at a time, and when those
data read by aio has not finish its endio(), its memory is likely to
be used in the next io_submit, which ends up data corruption and
numerous checksum errors.

This allocates memory for each io_submit() and generic/323 runs fine
after this.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/195: Use XFSDUMP_PROG instead of xfsdump directly
Jan Kara [Mon, 10 Nov 2014 02:05:22 +0000 (13:05 +1100)]
xfs/195: Use XFSDUMP_PROG instead of xfsdump directly

Use appropriate environment variable (XFSDUMP_PROG) instead of
hardcoding 'xfsdump' name. Also make the test fail graciously when
xfsdump isn't installed.

We also make XFSDUMP_PROG be equal to empty string instead of -e when
xfsdump isn't installed. The changes require some tweaking to output
filtering since full command path now appears in the output.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: regression test for btrfs extent merge
Qu Wenruo [Mon, 10 Nov 2014 02:04:00 +0000 (13:04 +1100)]
btrfs: regression test for btrfs extent merge

The following kernel commit introduced the bug:
51f395ad btrfs: Use right extent length when inserting overlap extent map.

When btrfs commit race with btrfs_get_extent(), merge_extent_mapping()
may build up a new extent which length overflows and cause extent map
insert fail, causing the caller get a -EEXIST error.

This regression is fixed by the following patches:
btrfs: Fix and enhance merge_extent_mapping() to insert best fitted extent map
btrfs: Fix the wrong condition judgment about subset extent map

Cc: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Tested-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: regression test for ro snapshot creation
Filipe Manana [Mon, 10 Nov 2014 02:03:43 +0000 (13:03 +1100)]
btrfs: regression test for ro snapshot creation

Regression test for a btrfs issue where creation of readonly snapshots caused
the filesystem to get into an inconsistent state.

This regression was introduced in the 3.17 kernel and fixed by reverting the
following linux kernel commit:

     Btrfs: race free update of commit root for ro snapshots
     9c3b306e1c9e6be4be09e99a8fe2227d1005effc

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs: test larger dump/restore to/from file
Eric Sandeen [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs: test larger dump/restore to/from file

This test creates a large-ish directory structure using
fsstress, and does a dump/restore to make sure we dump
all the files.

Without the fix for the regression caused by:
c7cb51d xfs: fix error handling at xfs_inumbers

we will see failures like:

    -xfsrestore: 486 directories and 1590 entries processed
    +xfsrestore: 30 directories and 227 entries processed

as it fails to process all inodes.

I think that existing tests have a much smaller set of files,
and so don't trip the bug.

I don't do a file-by-file comparison here, because for some
reason the diff output gets garbled; this test only checks
that we've dumped & restored the correct number of files.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/053: test for stale data exposure via falloc/writeback interaction
Brian Foster [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
xfs/053: test for stale data exposure via falloc/writeback interaction

XFS buffered I/O writeback has a subtle race condition that leads to
stale data exposure if the filesystem happens to crash after delayed
allocation blocks are converted on disk and before data is written back
to said blocks.

Use file allocation commands to attempt to reproduce a related, but
slightly different variant of this problem. The associated falloc
commands can lead to partial writeback that converts an extent larger
than the range affected by falloc. If the filesystem crashes after the
extent conversion but before all other cached data is written to the
extent, stale data can be exposed.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: regression test for btrfs incremental send
Filipe Manana [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
btrfs: regression test for btrfs incremental send

This is a regression test for a btrfs incremental send issue.
If between two snapshots we rename an existing directory named X to Y and
make it a child (direct or not) of a new inode named X, we were delaying
the move/rename of the former directory unnecessarily, which would result
in attempting to rename the new directory from its orphan name to name X
prematurely. This made btrfs receive fail with an error message like the
following:

   rename o261-7-0 -> merlin/RC/OSD failed

This issue was a regression in the 3.16 kernel and got fixed by the
following linux kernel btrfs patch:

   Btrfs: send, don't delay dir move if there's a new parent inode

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoshared/032: fix fsck failure
Wang Shilong [Tue, 14 Oct 2014 11:59:39 +0000 (22:59 +1100)]
shared/032: fix fsck failure

while running ./check tests/shared/032, it outputs something like:

FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 vm01 3.17.0-rc5+
MKFS_OPTIONS  -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /mnt/scratch

shared/032 2s ... 2s
_check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent (see /root/xfstests-dev/results//shared/032.full)
Ran: shared/032
Passed all 1 tests

This is because xfstests will run fsck after each unit test,
for tests/shared/032, we have reformated SCRATCH_DEV to other fs,
fix this problem by skipping fsck here.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: Re-enable testing over NFS
Anna Schumaker [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: Re-enable testing over NFS

83ef157 (common: Check fs consistency on TEST_DEV only when needed) has
_require_test unconditionally return _notrun when testing on an NFS
filesystem, essentially disabling NFS.  This patch changes the code to
validate $TEST_DEV and only call _notrun if validation fails.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/262: update filter to deal with long device name correctly
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
xfs/262: update filter to deal with long device name correctly

If the device name is too long, the output of xfs_quota -c "df" will be
broke into two lines as

Filesystem           1K-blocks       Used  Available  Use% Pathname
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                      15718400      32932   15685468    0% /mnt/testarea/scratch
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                        512000          0     512000    0% /mnt/testarea/scratch/test

and _filter_quota_rpt() couldn't catch the correct available number and
test will fail as

[root@hp-dl388g8-01 xfstests]# diff -u tests/xfs/262.out /root/xfstests/results//xfs/262.out.bad
--- tests/xfs/262.out   2014-10-08 20:16:19.000000000 +0800
+++ /root/xfstests/results//xfs/262.out.bad  2014-10-09 14:29:38.795813323 +0800
@@ -1,2 +1,4 @@
 QA output created by 262
 Silence is golden.
+hard limit 0 bytes, expected 524288000
+hard limit 0 bytes, expected 524288000

Update the filter so it could catch the correct value.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs/010: use _extent_count() helper
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs/010: use _extent_count() helper

cleanup to swith _extent_count(), this way we remove a
dependence on filefrag.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add regression for inode bad compression ratio detection
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: add regression for inode bad compression ratio detection

This test add a regression test to make sure btrfs dosen't set
inode NOCOMPRESS flag when a small write(<=blocksize) happens.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: test mount btrfs subvolume with selinux context
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: test mount btrfs subvolume with selinux context

If one subvolume was mounted with selinux context, other subvolumes
should be able to be mounted with the same selinux context too.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: fix test for ltp/fsstress
Wang Shilong [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
common: fix test for ltp/fsstress

Testing if FSSTRESS_PROG is a null string dosen't make sense because
it has just been set.

Here fix it by testing if it is an executable file.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run defrag and remount with different compress algorithms simultan...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run defrag and remount with different compress algorithms simultaneously

Run btrfs defrag operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs scrub and remount with different compress algorithms...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs scrub and remount with different compress algorithms simultaneously

Run btrfs scrub and remount with different compress algorithms
simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs scrub and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs scrub and defrag operations simultaneously

Run btrfs scrub and defrag operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run device replace and remount with different compress algorithms...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and remount with different compress algorithms simultaneously

Run btrfs replace operations and remount with different compress
algorithms simultaneously with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run device replace and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and defrag operations simultaneously

Run btrfs replace operations and defrag simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run device replace and scrub operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run device replace and scrub operations simultaneously

Run btrfs replace operations and scrub simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run subvolume create/delete and remount with defferent compress...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run subvolume create/delete and remount with defferent compress algorithms

Run btrfs subvolume create/mount/umount/delete and remount with
different compress algorithms simultaneously, with fsstress running in
background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete and defrag operations simultaneously

Run btrfs subvolume create/mount/umount/delete and btrfs defrag
operations simultaneously, with fsstress running in backgound.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete operations and scrub simultaneously

Run btrfs subvolume create/mount/umount/delete and btrfs scrub
operation simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs subvolume create/delete operations and device replace...
Eryu Guan [Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)]
btrfs: new case to run btrfs subvolume create/delete operations and device replace simultaneously

Run btrfs subvolume create/mount/umount/delete and device replace
operation simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs balance and device replace operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new case to run btrfs balance and device replace operations simultaneously

Run btrfs balance and replace operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new case to run btrfs balance and remount with different compress algorithms
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new case to run btrfs balance and remount with different compress algorithms

Run btrfs balance and remount with different compress algorithms
simultaneously, with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new test to run btrfs balance and defrag operations simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and defrag operations simultaneously

Run btrfs balance and defrag operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new test to run btrfs balance and scrub simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and scrub simultaneously

Run btrfs balance and scrub operations simultaneously with fsstress
running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: new test to run btrfs balance and subvolume test simultaneously
Eryu Guan [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
btrfs: new test to run btrfs balance and subvolume test simultaneously

Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
with fsstress running in background.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/287: Make test fail graciously when xfsdump isn't installed
Jan Kara [Tue, 14 Oct 2014 11:59:37 +0000 (22:59 +1100)]
xfs/287: Make test fail graciously when xfsdump isn't installed

Include common/dump into xfs/287 so that the test fails graciously when
xfsdump isn't installed.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/007: check correct quota inodes
Dave Chinner [Tue, 14 Oct 2014 06:40:34 +0000 (17:40 +1100)]
xfs/007: check correct quota inodes

Commit b8cac56 ("xfs/007: add project quota Q_XQUOTARM test") has
been broken since it was added - the new code checked the group
quota inode rather than the project quota inode and so always
reported a pre-RM block count of zero.  This occurred due to a copy
and paste of the existing user/group test code and didn't fix up all
the code properly.

Factor the common code into a single function, and pass in the
correct variables the tests require. While there, make sure that we
remove the 007.full file before the test starts to aid future
debugging and also check that project quotas are supported before
trying to test them.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: check overwriting rename
Miklos Szeredi [Tue, 14 Oct 2014 06:40:34 +0000 (17:40 +1100)]
generic: check overwriting rename

This tests whether the file or directory overwritten by rename is properly
removed (nlink is zero).

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/017: Do not create file systems with different block sizes
Lukas Czerner [Tue, 14 Oct 2014 06:40:32 +0000 (17:40 +1100)]
generic/017: Do not create file systems with different block sizes

User takes care about specifying mkfs options he wishes to test and the
test itself should not change it if it's not strictly necessary for the
test itself.

In this case it is not necessary and we should only test configuration
provided by the user. Moreover if the block size was already specified
some mkfs utilities does not handle multiple of the same parameters and
the mkfs utility fails making it re-try with only provided options
(ignoring what user specified), which is wrong.

In this case it's also a problem for btrfs file system which does not
support block size < page size.

Fix it by removing the mkfs, and testing existing configuration only.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: Introduce get_block_size() helper
Lukas Czerner [Tue, 14 Oct 2014 06:07:52 +0000 (17:07 +1100)]
common: Introduce get_block_size() helper

Currently many tests and other functions uses it's own way to get block
size of the file system. Introduce get_block_size(), a generic way to
get block size of mounted file system and use that instead.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: add dir fsync test
Filipe Manana [Mon, 29 Sep 2014 03:26:32 +0000 (13:26 +1000)]
generic: add dir fsync test

This test is motivated by a bug found in btrfs when replaying a
directory from the fsync log. The issue was that if a directory
entry is both found in the persisted metadata and in the fsync
log, at log replay time the directory got set with a wrong i_size.
This had the consequence of not being able to rmdir empty
directories (failed with errno ENOTEMPTY).
This was fixed in btrfs with the following linux kernel patch:

     Btrfs: fix directory recovery from fsync log

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofstest: fix dumping of miscompare buffer
Christoph Hellwig [Mon, 29 Sep 2014 03:11:33 +0000 (13:11 +1000)]
fstest: fix dumping of miscompare buffer

When fstests finds a miscompare it tries to dump the corrupted
bytes from the buffer, but due to an incorrect comparism actully
dumps the correct part of it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofsx: increase number of logged operations
Christoph Hellwig [Mon, 29 Sep 2014 03:11:05 +0000 (13:11 +1000)]
fsx: increase number of logged operations

1000 operations is not nearly enough to debug complex data integrity
issues, so increase the log buffer by an order of magnitude.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/033: add xfs delalloc indirect block depletion reproducer
Brian Foster [Mon, 29 Sep 2014 03:10:25 +0000 (13:10 +1000)]
generic/033: add xfs delalloc indirect block depletion reproducer

XFS allocates extra indirect blocks for delayed allocation extents at
write time. When delalloc extents are split, the existing indirect block
reservation was historically divided up evenly among the new extents
even though the overall requirement for two extents could exceed the
requirement for the original. Repeated delalloc extent splits ultimately
leads to extents with 0 indirect blocks and in turn leads to assert
failures in XFS.

Add a test to stress indirect block reservation for delayed allocation
extents. The test converts a single delalloc extent to many and operates
on the remaining extents to detect or trigger potential problems.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/032: add xfs unwritten extent data corruption reproducer
Brian Foster [Mon, 29 Sep 2014 03:10:05 +0000 (13:10 +1000)]
generic/032: add xfs unwritten extent data corruption reproducer

XFS had a data corruption problem where writeback of pages to unwritten
extents would fail to run unwritten extent conversion at I/O completion.
This causes subsequent reads of written, but unconverted regions to
return zeroes. This occurs on sub-page block size filesystems when
writeback contends for the inode lock (e.g., with a file writer).

Add a test that creates the conditions to reproduce the data corruption
and detect it by looking for unwritten extents after all said extents
have been overwritten.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/100: Don't use the -R option for tar
Ari Sundholm [Mon, 29 Sep 2014 03:09:37 +0000 (13:09 +1000)]
generic/100: Don't use the -R option for tar

It does not seem to be necessary and is not supported by busybox
tar.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/310: killall does not need pathnames
Ari Sundholm [Mon, 29 Sep 2014 03:09:07 +0000 (13:09 +1000)]
generic/310: killall does not need pathnames

Only the executable name is required and this allows busybox
killall to be used.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agotests: Use stat -c
Ari Sundholm [Mon, 29 Sep 2014 03:07:26 +0000 (13:07 +1000)]
tests: Use stat -c

Change all occurrences of stat --format and stat --printf to stat -c
so that the tests work correctly on BusyBox systems.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: redirect dd stderr to stdout.
Ari Sundholm [Mon, 29 Sep 2014 02:59:45 +0000 (12:59 +1000)]
common: redirect dd stderr to stdout.

So that the checks work correctly on BusyBox systems.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: add write vs fcollapse test
Dave Chinner [Mon, 29 Sep 2014 02:58:24 +0000 (12:58 +1000)]
generic: add write vs fcollapse test

This test exposed a problem with XFS where it failed to write back a
partial page correctly during a fcollapse operation. This left a
stray dirty buffer on the page, and hence invalidation of the page
then failed of the fcollapse returned an EBUSY error.

Make this a generic test so that we can ensure that all filesystems
handle the case correctly. Test case originally worked out and
written by Brian Foster.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: add mmap write vs truncate/remap test
Dave Chinner [Mon, 29 Sep 2014 02:57:37 +0000 (12:57 +1000)]
generic: add mmap write vs truncate/remap test

This test exposed a problem with mapped writes to the tail page of a
file in XFS and potentially ext4. Eric did all the hard work of
taking the bug report and generating the reproducable test case on
ext4.  Make it a generic test so that we can ensure that all
filesystems handle the case correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: add mmap write vs truncate test
Dave Chinner [Mon, 29 Sep 2014 02:56:48 +0000 (12:56 +1000)]
generic: add mmap write vs truncate test

This test exposed a problem with mapped writes to the tail page of a
file in XFS. Hence make it a generic test so taht we can ensure that
all fielsystems handle the case correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocheck: more tests that shouldn't check the scratch device
Dave Chinner [Mon, 29 Sep 2014 02:56:28 +0000 (12:56 +1000)]
check: more tests that shouldn't check the scratch device

xfs/200 leaves a dirty log as readonly filesystems don't write
unmount records to mark the log clean.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: more tests should clean up TESTDIR on success
Dave Chinner [Mon, 29 Sep 2014 02:56:16 +0000 (12:56 +1000)]
generic: more tests should clean up TESTDIR on success

I'm getting enospc errors on a 4GB test device after a while of
running. Part of the issue is that many tests can't or don't clean
up previous failed runs when they start or if the run to success.
Hence while we want to slowly age the test filesystem, we don't
really want that aging to unintentionally run the filesystem out of
space. To that end:

$ sudo du -s /mnt/test/* | sort -nr |head -10
1929160 /mnt/test/fsfile
512000  /mnt/test/247.8133
512000  /mnt/test/247.4713
512000  /mnt/test/247.4488
466752  /mnt/test/fstest.9850.2
40000   /mnt/test/resv
29804   /mnt/test/fsstress.12144.1
26208   /mnt/test/populate_root
26208   /mnt/test/mnt
23216   /mnt/test/fsstress.4491.1

We can see that there are a few tests that using most of the space.
These are often left behind due to kernel failures during tests or
reboots while tests are in progress, so make sure that they at least
clean up such mess the next time they run.

Test generic/247, xfs/020 (fsfile) and generic/074 (fstest.$$.n)
are the worst offenders, so just target these to being with.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/005: sync superblock modification to disk before mount test
Eric Sandeen [Mon, 29 Sep 2014 02:55:54 +0000 (12:55 +1000)]
xfs/005: sync superblock modification to disk before mount test

This test tries to directly corrupt the CRC field of the primary
superblock by using xfs_io pwrite, but never syncs it to disk,
so it's quite likely that the mount will not see the bad data.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: use _nocheck for btrfs/011 and btrfs/012
Josef Bacik [Mon, 29 Sep 2014 02:55:20 +0000 (12:55 +1000)]
btrfs: use _nocheck for btrfs/011 and btrfs/012

These two tests blow up on the scratch test, but 011 leaves the devices in a
state where the first scratch dev is no longer part of any file system and 012
leaves the scratch dev as an ext4 file system.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add test regarding clearing compression flag/property
Filipe Manana [Mon, 29 Sep 2014 02:54:55 +0000 (12:54 +1000)]
btrfs: add test regarding clearing compression flag/property

Regression test for btrfs where removing the flag FS_COMPR_FL
(chattr -c) from an inode wouldn't clear its compression property.
This was fixed in the following linux kernel patch:

  Btrfs: add missing compression property remove in btrfs_ioctl_setflags

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: speed up _require_ext4_bigalloc and _require_ext4_mkfs_bigalloc
Theodore Ts'o [Mon, 29 Sep 2014 02:52:23 +0000 (12:52 +1000)]
ext4: speed up _require_ext4_bigalloc and _require_ext4_mkfs_bigalloc

We don't need to make a full-sized file system in order to test
whether "mkfs.ext4 -O bigalloc" works.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: use mkfs.ext4 -F instead of piping in yes
Theodore Ts'o [Mon, 29 Sep 2014 02:47:02 +0000 (12:47 +1000)]
ext4: use mkfs.ext4 -F instead of piping in yes

Using "yes | mkfs.ext4 ..." results in the error message results in
the test failing, at least for some versions of e2fsprogs:

    +yes: standard output: Broken pipe
    +yes: write error

It better to use the -F option, which will eliminate the questions.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: define MKFS_EXT4_PROG
Theodore Ts'o [Mon, 29 Sep 2014 02:46:43 +0000 (12:46 +1000)]
ext4: define MKFS_EXT4_PROG

And use it instead of "mkfs.ext4" / "mkfs -t ext4"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/051: test buffer use after free race on I/O failure in XFS log recovery
Brian Foster [Mon, 8 Sep 2014 12:51:39 +0000 (22:51 +1000)]
xfs/051: test buffer use after free race on I/O failure in XFS log recovery

A buffer use after free race was discovered in the XFS log recovery
codepath if I/O failures occur during recovery. The I/O submission path
can abort the mount and release the only reference held on some buffers
before I/O completion processing (e.g., async workqueue processing)
might have completed. Badness ensues if the I/O completion path
subsequently attempts to access said buffers.

The test manufactures the race by forcing all writes to fail (via
dm-flakey) after a fixed period of time. A delay is inserted into the
mount codepath to synchronize write failures with log recovery.

Credit for discovery of the race and definition of the reproducible test
case goes to Alex Lyakas.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reported-by: Alex Lyakas <alex@zadarastorage.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfstests/common: don't assume sysfs attrs all reside under test dev
Brian Foster [Mon, 8 Sep 2014 12:26:53 +0000 (22:26 +1000)]
xfstests/common: don't assume sysfs attrs all reside under test dev

_require_xfs_sysfs() currently assumes that all sysfs attributes reside
under a device-specific subdirectory in the XFS sysfs hierarchy. It is
hardcoded to use the TEST_DEV mount and expect the relative attribute
path as a parameter.

Not all sysfs attributes are associated with specific devices or mount
points, however. Remove the hardcoded device name part of the attribute
path from _require_xfs_sysfs() and let the caller construct the relative
path based on the sysfs XFS root directory.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoext4: require fallocate support to run ext4/307
Theodore Ts'o [Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)]
ext4: require fallocate support to run ext4/307

Some file system configurations don't support fallocate, which is
required for e4defrag to run.  So add a _require_xfs_io_command to
prevent a test failure if fallocate isn't supported in (for example)
ext3 compatibility mode.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfstests: generic: add test for double msync, motivated by a btrfs bug
Filipe Manana [Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)]
xfstests: generic: add test for double msync, motivated by a btrfs bug

This test is motivated by a btrfs issue where a ranged fsync would
prevent a subsequent fsync from persisting any extents that were
dirty at the time of the first fsync but that were outside the range
of that first fsync (which should have been persisted by the second
fsync).

This bug in btrfs is fixed by the following linux kernel patch:

     Btrfs: fix fsync data loss after a ranged fsync

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocifs: skip tests that need POSIX support for nounix mounts
Pavel Shilovsky [Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)]
cifs: skip tests that need POSIX support for nounix mounts

CIFS/SMB protocol without POSIX extensions doesn't support operations
with symbolic links and advisory byte-range locks from the same process.
Add checks these features and use them in generic tests that require
such operations.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon: add cifs support
Pavel Shilovsky [Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)]
common: add cifs support

Pass -cifs argument from the command line to enable cifs testing
for $TEST_DEV. Also mention CIFS and missed UDF in README.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>