]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/log
xfstests-dev.git
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 years agogeneric/013: encapsulate remount during cleanup
Pavel Shilovsky [Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)]
generic/013: encapsulate remount during cleanup

The existing code calls remount for $TEST_DEV with constantly defined
mount options. This can fail if a user specifies different mount options.
Fix this by using new _test_remount() call that remounts $TEST_DEV.

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>
10 years agoext4/308: add new defrag compact test case
Dmitry Monakhov [Mon, 8 Sep 2014 12:26:49 +0000 (22:26 +1000)]
ext4/308: add new defrag compact test case

Check data integrity and layout stability during defrag compacting
EXT4_IOC_MOVE_EXT swap extents between target and donor inode.
If ioctl was performed twice then inode's layout should not change.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agosrc/e4compact: add sparse file optimization
Dmitry Monakhov [Mon, 8 Sep 2014 10:49:52 +0000 (20:49 +1000)]
src/e4compact: add sparse file optimization

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agosrc/e4compact: handle various block_size correctly
Dmitry Monakhov [Mon, 8 Sep 2014 10:49:43 +0000 (20:49 +1000)]
src/e4compact: handle various block_size correctly

EXT4_IOC_MOVE_EXT requires both files has same offset inside page

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agosrc/e4compact cleanup
Dmitry Monakhov [Mon, 8 Sep 2014 10:49:35 +0000 (20:49 +1000)]
src/e4compact cleanup

- fix incorrect donor offset initialization.
- fix donor name logging.
- handle EOPNOTSUPP correctly

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: _scratch_mkfs_sized inherent default block size from MKFS_OPTIONS
Dmitry Monakhov [Mon, 8 Sep 2014 10:49:26 +0000 (20:49 +1000)]
common: _scratch_mkfs_sized inherent default block size from MKFS_OPTIONS

Currently default block size is frozen to 4096 which is bad for
various reasons. e.g:

1) It ignores MKFS_OPT
2) Does not work for architectures where PG_SIZE != 4096

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: add _mkfs_dev helper
Dmitry Monakhov [Mon, 8 Sep 2014 10:49:14 +0000 (20:49 +1000)]
common: add _mkfs_dev helper

It is not good practice to directly use MKFS_PROG.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agofilter: update xfs_repair filter for new sunit/swidth warning
Dave Chinner [Mon, 8 Sep 2014 10:48:59 +0000 (20:48 +1000)]
filter: update xfs_repair filter for new sunit/swidth warning

New xfs_repair programs have a different sunit/swidth warning that
is triggering failures such as:

    -Note - stripe unit (0) and width (0) fields have been reset.
    -Please set with mount -o sunit=<value>,swidth=<value>
    +Note - stripe unit (0) and width (0) were copied from a backup superblock.
    +Please reset with mount -o sunit=<value>,swidth=<value> if necessary

Update the filter to catch both cases and output the old message so
tests pass again.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: don't check scratch dev on all tests
Dave Chinner [Mon, 8 Sep 2014 10:48:45 +0000 (20:48 +1000)]
common: don't check scratch dev on all tests

Some tests deliberately corrupt  scratch devices and so will fail
the post-test check. Add a "_require_scratch_nocheck" helper
function for such tests to avoid false test failure detection.

Also, ensure that _notrun cleans up the trigger for the post-test
checks. Otherwise the next test to run may try to validate the
scratch/test devices even though they are not used by the test.

Further, _check_xfs_filesystem() causes check to exit if it finds a
corruption. This is extremely annoying as it terminates the entire
test run rather than just reporting that the test fails. Hence add
an "iam != check" test before exiting so that calls from tests will
cause the test to fail, but calls from check won't cause the harness
to exit.

There are still some tests that fail the scratch check, these are
not obvious test failures and so need further investigation to
determine the cause of the failures.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/225: Require fiemap support
Jan Kara [Wed, 13 Aug 2014 01:20:59 +0000 (11:20 +1000)]
generic/225: Require fiemap support

Add _require_xfs_io_command "fiemap" to test 225 to properly handle the
situation when fiemap isn't supported by the filesystem.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: allow dmflakey tests to work without udev
Theodore Ts'o [Wed, 13 Aug 2014 01:20:57 +0000 (11:20 +1000)]
common: allow dmflakey tests to work without udev

If udev is not present, we need to run "dmsetup mknodes" to make sure
/dev/mapper/flakey-test is created or destroyed as appropriate.  On a
system with udev, running "dmsetup mknodes" will be a no-op.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric/077: fall back to /usr if /lib/modules doesn't exist
Theodore Ts'o [Wed, 13 Aug 2014 01:20:56 +0000 (11:20 +1000)]
generic/077: fall back to /usr if /lib/modules doesn't exist

We need a source of "filler" that can fill up a 50M file system.
Unfortunately, on some systems /lib/modules might not exist at all.
In that case, use /usr instead.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobuild: Fix test for libgdbm_compat when building statically
Theodore Ts'o [Wed, 13 Aug 2014 01:20:54 +0000 (11:20 +1000)]
build: Fix test for libgdbm_compat when building statically

When building statically, -lgdbm_compat will not automatically pull in
-lgdbm.  So this needs to be specified explicitly in AC_CHECK_LIB and
in the list of libraries passed to the linker.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoconfig: allow chacl to be in any directory in $PATH
Theodore Ts'o [Wed, 13 Aug 2014 01:20:52 +0000 (11:20 +1000)]
config: allow chacl to be in any directory in $PATH

Previously, xfstests checked for chacl in only a few hard-coded
directory: /bin, /sbin, and /usr/bin.  Use set_prog_path to allow
chacl to be in any directory in $PATH, which is how we find the
executable path for most other executables.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add regression test for btrfs send with orphans
Filipe Manana [Wed, 13 Aug 2014 01:20:37 +0000 (11:20 +1000)]
btrfs: add regression test for btrfs send with orphans

Regression test for a btrfs issue where we create a RO snapshot
to use for a send operation, which fails with a -ESTALE error,
due to the presence of orphan inodes accessible through the
snapshot's commit root but no longer present through the main
root.

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

  Btrfs: update commit root on snapshot creation after orphan cleanup

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoext4: add new compacting defragmentation test
Dmitry Monakhov [Wed, 13 Aug 2014 01:20:35 +0000 (11:20 +1000)]
ext4: add new compacting defragmentation test

EXT4_MOVE_EXTENT is ready to support case where orig_offset != donor_offset.
This case is usable for compacting small files together.
Test generate file hierarchy via fsstress and then compact all files
to one adjacent block.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agogeneric: add new defragment test
Dmitry Monakhov [Wed, 13 Aug 2014 01:19:33 +0000 (11:19 +1000)]
generic: add new defragment test

Check defrag utility on file with large number of fragments, from 20 to 2000.
2000 fragments means that b+tree will have at least two index blocks.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agodefrag: add options to _defrag helper
Dmitry Monakhov [Wed, 13 Aug 2014 01:16:49 +0000 (11:16 +1000)]
defrag: add options to _defrag helper

Sometimes it is not easy to know number of expected extents in advance.
In that case it is reasonable to provide sane MIN and MAX values.
Also helper will check that number of extents before defragmentaion
is not greather than after.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: check for matching kernel send stream
Anand Jain [Wed, 13 Aug 2014 01:16:42 +0000 (11:16 +1000)]
btrfs: check for matching kernel send stream

The test case btrfs/049 is relevant to send stream version 2, and
needs kernel patches as well. So call _notrun if there isn't
matching kernel support as shown below

btrfs/047  [not run] Missing btrfs kernel patch for send stream version 2, skipped this test
Not run: btrfs/047

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: test strided xfs_repair on large filesystems
Eryu Guan [Wed, 13 Aug 2014 01:16:39 +0000 (11:16 +1000)]
xfs: test strided xfs_repair on large filesystems

Test segfault issue when repairing large xfs.

Regression test for xfsprogs commit
7f2d6b8 xfs_repair: avoid segfault if reporting progress early in repair

The original test is from the commit log, written by Eric Sandeen.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/007: add project quota Q_XQUOTARM test
Jie Liu [Wed, 13 Aug 2014 01:15:46 +0000 (11:15 +1000)]
xfs/007: add project quota Q_XQUOTARM test

Add test for project quota Q_XQUOTARM operations, update the
golden output file to match the new test output.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: _devmgt_add() to check if the device is back online
Anand Jain [Wed, 13 Aug 2014 01:15:43 +0000 (11:15 +1000)]
common: _devmgt_add() to check if the device is back online

btrfs/003 uses a method to remove the device as part of the test
case, and after the test completes the removed device is added
back to the system. However on certain system, albeit the slow
running system the device comes back a bit later, and so the
latter occurring sub-test with in the btrfs/003 fails.

This patch adds script to wait and test if the device is back online,
and thus report the same to to the full log.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoshared/006: use _get_free_inode helper
Eryu Guan [Wed, 13 Aug 2014 01:15:41 +0000 (11:15 +1000)]
shared/006: use _get_free_inode helper

Use _get_free_inode helper to get free inode count.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs: test inode allocations in post-growfs disk space
Eryu Guan [Wed, 13 Aug 2014 01:15:23 +0000 (11:15 +1000)]
xfs: test inode allocations in post-growfs disk space

Make sure inodes can be allocated in new space added by xfs_growfs.

Regression test for
xfs: allow inode allocations in post-growfs disk space

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoext4: regression test for wrong assert in ext4_mb_normalize_request()
Xiaoguang Wang [Wed, 13 Aug 2014 01:15:15 +0000 (11:15 +1000)]
ext4: regression test for wrong assert in ext4_mb_normalize_request()

Regression test for:
    b5b6077 ext4: fix wrong assert in ext4_mb_normalize_request()

Meanwhile make minor changes to _scratch_mkfs_ext4() in common/rc,
_scratch_mkfs_ext4() might fail due to conflicts between being passed options
and MKFS_OPTIONS. We fix this by ignoring MKFS_OPTIONS if it fails the first
time(see _scratch_mkfs_xfs()), as suggested by Lukas Czerner.

[dchinner: converted to use xfs_io]

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>
10 years agocommon: Check fs consistency on TEST_DEV only when needed
Lukas Czerner [Wed, 13 Aug 2014 01:08:41 +0000 (11:08 +1000)]
common: Check fs consistency on TEST_DEV only when needed

Currently we're checking file system consistency on TEST_DEV after every
successful test run even though the TEST_DEV might not even be used in
that test.

Fix it by introducing _require_test to for the test ti indicate that
it's about to use TEST_DEV.

Also add _require_test to the new script so that this requirement is a
default.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agocommon: Check the file system consistency on SCRATCH_DEV
Lukas Czerner [Wed, 13 Aug 2014 01:01:04 +0000 (11:01 +1000)]
common: Check the file system consistency on SCRATCH_DEV

There are about 198 tests which requires scratch_dev, but does not check
the file system consistency afterwards. Xfstests infrastructure does not
do it automatically, so fix it by running _check_scratch_fs() after
each test that _require_scratch.

Also remove all the _check_scratch_fs() calls that are not actually needed
and will be covered by the check script.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/291: use xfs_repair -f when repairing a fs image
Eric Sandeen [Wed, 13 Aug 2014 01:00:46 +0000 (11:00 +1000)]
xfs/291: use xfs_repair -f when repairing a fs image

test xfs/291 creates an xfs_metadump image and runs repair on it.
Technically, this is supposed to require "-f" to specify that
the target of the repair is a file; this allows buffered IO fallback
in the case where the image sector size is smaller than the device
sector size.  And in fact if we create the image on a hard 4k device,
the test will fail when repair is unable to operate on the image.

So add that -f!

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/300: redirect mkfs output to results/xfs directory
Xing Gu [Wed, 13 Aug 2014 01:00:43 +0000 (11:00 +1000)]
xfs/300: redirect mkfs output to results/xfs directory

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoxfs/292: fix format of expected message
Xing Gu [Wed, 13 Aug 2014 01:00:38 +0000 (11:00 +1000)]
xfs/292: fix format of expected message

In mkfs.xfs, it uses left-align and fixed width format when outputting
device name, so variable length of devicename makes different space's
number between "meta-data=devicename" and "isize". But in the expected
output, the space' number between them is fixed. This behavior often
results in the case failure. So fix the format of expected message.

Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agoaio: test closing the fd before destroying the ioctx
Jeff Moyer [Wed, 13 Aug 2014 01:00:38 +0000 (11:00 +1000)]
aio: test closing the fd before destroying the ioctx

By closing the file descriptor before calling io_destroy, you pretty
much guarantee that the last put on the ioctx will be done in interrupt
context (during I/O completion).  This behavior has unearthed bugs in
the kernel in several different kernel versions, so let's add a test to
poke at it.

The original test case was provided by Matt Cross.  He has graciously
relicensed it under the GPL v2 or later so that it can be included in
xfstests.  I've modified the test a bit so that it would generate a
stable output format and to run for a fixed amount of time.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
10 years agobtrfs: add qgroup rescan stress test
Wang Shilong [Wed, 13 Aug 2014 00:59:59 +0000 (10:59 +1000)]
btrfs: add qgroup rescan stress test

Test flow is to run fsstress after triggering quota rescan.
the ruler is simple, we just remove all files and directories,
sync filesystem and see if qgroup's ref and excl are nodesize.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agogeneric/317,318: fail gracefully if userns not supported
Eric Sandeen [Tue, 17 Jun 2014 23:34:39 +0000 (09:34 +1000)]
generic/317,318: fail gracefully if userns not supported

generic/317 and generic/318 fail un-gracefully on older kernels
which don't support userns; fix that by running a simple test
as a prerequisite and fail gracefully if needed.

Roll that in with the test for executable presence, and make
a new _require_userns()

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agoxfs/279: use MKFS_XFS_PROG, not hardcoded path
Eric Sandeen [Tue, 17 Jun 2014 23:34:03 +0000 (09:34 +1000)]
xfs/279: use MKFS_XFS_PROG, not hardcoded path

I'm really not sure why this wasn't this way from the start.
On some systems it's in /usr/sbin, and the test fails.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: create a test for xfs log grant head leak detection
Brian Foster [Tue, 17 Jun 2014 23:33:46 +0000 (09:33 +1000)]
xfstests: create a test for xfs log grant head leak detection

Changes in the XFS logging code have lead to small leaks in the log
grant heads that consume log space slowly over time. Such problems have
gone undetected for an unnecessarily long time due to code complexity
and potential for very subtle problems. Losing only a few bytes per
logged item on a reasonably large enough fs (10s of GB) means only the
most continuously stressful workloads will cause a severe enough failure
(deadlock due to log reservation exhaustion) quickly enough to indicate
something is seriously wrong.

Recent changes in XFS export the state of the various log heads through
sysfs to aid in userspace/runtime analysis of the log. This test runs a
workload against an XFS filesystem, quiesces the fs and verifies that
the log reserve and write grant heads have not leaked any space with
respect to the current head of the physical log.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agoxfstests: test speculative preallocation reclaim on ENOSPC/EDQUOT
Brian Foster [Tue, 17 Jun 2014 23:33:26 +0000 (09:33 +1000)]
xfstests: test speculative preallocation reclaim on ENOSPC/EDQUOT

XFS can allocate significant amounts of space to files via speculative
preallocation. Such preallocation may not be reclaimed automatically on
file close() if a file is repeatedly opened and extended. For smaller
filesystems with relatively large and slow growing files, this
preallocation can linger for some time, including contributing to out of
space conditions.

Create a situation where an fs is near out of space while several files
still have lingering, significant preallocations. Verify that new
writers reclaim the preallocated space rather than return ENOSPC. Repeat
a similar test for quota limits and EDQUOT.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agosrc/cloner: add CIFS_IOC_COPYCHUNK_FILE support
David Disseldorp [Tue, 17 Jun 2014 23:32:59 +0000 (09:32 +1000)]
src/cloner: add CIFS_IOC_COPYCHUNK_FILE support

cifs.ko supports server-side copy offloads via CIFS_IOC_COPYCHUNK_FILE.
In handling the ioctl, the request is split into a series of
SMB2 FSCTL_SRV_COPYCHUNK wire requests, which may be handled by the SMB
server as a local read/write, or COW clone as is the case for Samba with
vfs_btrfs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agosrc/cloner: check filesystem type
David Disseldorp [Tue, 17 Jun 2014 23:32:25 +0000 (09:32 +1000)]
src/cloner: check filesystem type

Limit clone requests to Btrfs only for the moment.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
11 years agogeneric: new case to test getcwd(2)
Eryu Guan [Tue, 17 Jun 2014 23:31:38 +0000 (09:31 +1000)]
generic: new case to test getcwd(2)

The following kernel commit introduced a race condition that causes
getcwd(2) to return "/" instead of correct path

232d2d6 dcache: Translating dentry into pathname without taking rename_lock

Jan Stancek hit it once when building ltp and Mikulas Patocka could
hit it by running lvm2 test suite. Please refer to this thread

https://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg17896.html

These commits fixed the bug
ede4ceb prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts
f650080 __dentry_path() fixes

Cc: Artem Savkov <asavkov@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>