xfstests-dev.git
7 years agofstests: support check for uuidgen utility
Brian Foster [Thu, 16 Jun 2016 12:28:48 +0000 (08:28 -0400)]
fstests: support check for uuidgen utility

A recent test uses the uuidgen utility to generate UUID-based
filenames, but this package is not necessarily installed as part of
the core packages of every distro.

As such, add the UUIDGEN_PROG environment variable to the common
configuration and update the test to require the existence of
uuidgen to run.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agobtrfs: qgroup handling on data extents balance
Qu Wenruo [Tue, 14 Jun 2016 09:26:27 +0000 (17:26 +0800)]
btrfs: qgroup handling on data extents balance

Btrfs after v4.2 kernel will leaks qgroup numbers for relocated data
extents, due to the design of tree block direct swap.

This test case will check if such data balance will corrupt qgroup.

Reported-by: Mark Fasheh <mfasheh@suse.de>
Reported-by: Filipe Manana <fdmanana@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: check remount on I/O errors
Eryu Guan [Mon, 13 Jun 2016 16:32:40 +0000 (00:32 +0800)]
generic: check remount on I/O errors

XFS had a bug to hang on remount in this case, this kernel commit
fix the issue.

5cb13dc cancel the setfilesize transation when io error happen

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: check symlink to very long path
Eryu Guan [Mon, 13 Jun 2016 13:49:25 +0000 (21:49 +0800)]
generic: check symlink to very long path

Test symlink to very long path, so that path could not be hold in
inode, then check symlink file contains correct path.

There was a bug in CRC XFS, that the path in remote symlink was not
correct, this issue is fixed by this kernel commit

2ac56d3 xfs: fix remote symlinks on V5/CRC filesystems

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoext4: regression test for fsync transaction ids initialization
Wang Xiaoguang [Wed, 15 Jun 2016 06:37:10 +0000 (14:37 +0800)]
ext4: regression test for fsync transaction ids initialization

Commit 688f869 fixed this bug:
    ext4: Initialize fsync transaction ids in ext4_new_inode()

We manually modify jbd2 journal_superblock_s.s_sequence to be a very
large number, which will greatly reduce the time taken to trigger
this bug, though it seems some too hacked.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoshared: check corrupted orphaned inode list handling
Guangwen Feng [Wed, 15 Jun 2016 05:21:31 +0000 (13:21 +0800)]
shared: check corrupted orphaned inode list handling

Commit c9eb13a fixed this bug:
ext4: fix hang when processing corrupted orphaned inode list

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agobtrfs: check qgroup on extent de-reference
Lu Fengqi [Tue, 14 Jun 2016 01:42:39 +0000 (09:42 +0800)]
btrfs: check qgroup on extent de-reference

Test if qgroup can handle extent de-reference during reallocation.
"extent de-reference" means that reducing an extent's reference
count or freeing an extent.

Although current qgroup can handle it, we still need to prevent any
regression which may break current qgroup.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agofstests: add _require_command check to killall
Masayoshi Mizuma [Mon, 13 Jun 2016 02:58:01 +0000 (11:58 +0900)]
fstests: add _require_command check to killall

Some tests use killall command, but killall may not exist.
We should check whether killall exists or not.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/122: don't break on old xfsprogs
Darrick J. Wong [Tue, 31 May 2016 16:43:52 +0000 (09:43 -0700)]
xfs/122: don't break on old xfsprogs

If we're running against a old version of xfsprogs that lacks some
of the structures that the golden output knows about, copy the
structure size definition from the golden output to the program
output.  This way we can check for structure size mutations on old
xfsprogs without generating false error reports for structs that
don't exist in the old release.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoreflink: change block sharing with constant refcount
Darrick J. Wong [Thu, 26 May 2016 05:57:49 +0000 (22:57 -0700)]
reflink: change block sharing with constant refcount

Ensure that we can handle the case where the refcount stays the same
even though the actual sharers changes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs: map multiple bmbt records to a single rmapbt record
Darrick J. Wong [Fri, 27 May 2016 03:28:51 +0000 (20:28 -0700)]
xfs: map multiple bmbt records to a single rmapbt record

Make sure that we can handle multiple bmbt records mapping to a
single rmapbt record.  This can happen if you fallocate more than
2^21 contiguous blocks to a file.

(Also add some helpers that can create huge devices with some
dm-zero and dm-snapshot fakery.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoreflink: avoid reflink on swap files
Darrick J. Wong [Thu, 26 May 2016 05:57:36 +0000 (22:57 -0700)]
reflink: avoid reflink on swap files

Since none of the current filesystems support reflinked swap files,
make sure that we prohibit reflinking of swapfiles and swapon of
reflinked files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs: check accounting during refcountbt expansion
Darrick J. Wong [Thu, 26 May 2016 05:57:29 +0000 (22:57 -0700)]
xfs: check accounting during refcountbt expansion

Ensure that refcountbt allocations during truncate operations come
from the per-AG reservation and are not charged to the transaction.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs: recover copy-on-write leftover
Darrick J. Wong [Thu, 26 May 2016 05:57:23 +0000 (22:57 -0700)]
xfs: recover copy-on-write leftover

Test recovery of CoW leftovers in xfs_repair.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: don't put loop control files on the scratch mount
Darrick J. Wong [Fri, 27 May 2016 03:28:05 +0000 (20:28 -0700)]
generic: don't put loop control files on the scratch mount

If we're doing write/overwrite/snapshot/resource exhaustion tests on
the scratch device, use the test directory to hold the loop
termination signal files.  This way we don't run infinitely because
we can't create the flag due to ENOSPC.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/104: don't enospc when ag metadata overhead grows
Darrick J. Wong [Thu, 26 May 2016 05:57:08 +0000 (22:57 -0700)]
xfs/104: don't enospc when ag metadata overhead grows

Adapt to different metadata overhead sizes by trying to reserve
decreasing amounts of disk space until we actually succeed at it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/131: dynamically allocate tcp listen port to avoid port clashes
Tahsin Erdogan [Wed, 8 Jun 2016 18:52:41 +0000 (11:52 -0700)]
generic/131: dynamically allocate tcp listen port to avoid port clashes

Current port selection algorithm is bound to have port clashes. To
eliminate clashes, let server pick an unused port and report it on
stdout.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoshared/272: don't try to use O_DIRECT
Theodore Ts'o [Thu, 9 Jun 2016 18:42:31 +0000 (14:42 -0400)]
shared/272: don't try to use O_DIRECT

A comment in shared/272 claims that ext4 supports O_DIRECT in
data=journalling mode.  Actually, it doesn't, it was just silently
ignoring O_DIRECT, let's not try to test O_DIRECT for either ext3 or
ext4 in this test.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: mark tests that require O_DIRECT
Theodore Ts'o [Thu, 9 Jun 2016 18:42:08 +0000 (14:42 -0400)]
generic: mark tests that require O_DIRECT

generic/094 and generic/225 use fiemap-tester, which requires
O_DIRECT.

generic/311 requests fsync-tester to use O_DIRECT.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agodefrag: test $TEST_DEV for extents for ext4 defrag
Theodore Ts'o [Thu, 9 Jun 2016 18:41:09 +0000 (14:41 -0400)]
defrag: test $TEST_DEV for extents for ext4 defrag

Commit 902223bdbbf2: "defrag: require extents support for ext4
defrag" added a test to make sure the ext4 file system has extents
enabled by testing the scratch device.  Unfortunately at the time
when _require_defrag is run, the scratch file system hasn't been
initialized yet by the test, so its contents are undefined.

If the previous test explicitly creates a file system with extents
disabled on $SCRATCH_DEV (such as ext4/306), then subsequent tests
(e.g., ext4/307 and ext4/306) will refuse to run.

Fix this by testing $TEST_DEV instead of $SCRATCH_DEV.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/186-7: fix unreferenced variables
Christoph Hellwig [Wed, 8 Jun 2016 18:17:31 +0000 (20:17 +0200)]
generic/186-7: fix unreferenced variables

There is not i variable in scope, and the comments suggest the
operation is to be done on ${file}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/015,274: add to the 'enospc' group
Wang Xiaoguang [Mon, 6 Jun 2016 10:25:30 +0000 (18:25 +0800)]
generic/015,274: add to the 'enospc' group

From test purposeļ¼Œboth two test cases belong to 'enospc' group.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs: discontiguous multi-block buffer logging test
Brian Foster [Thu, 2 Jun 2016 13:10:01 +0000 (09:10 -0400)]
xfs: discontiguous multi-block buffer logging test

XFS had a bug in the multi-block buffer logging code that caused a
NULL lv panic at log push time due to invalid regions being set in
the buffer log format bitmap. This was demonstrated by modifying a
multi-block directory buffer in a manner that only logs regions
beyond the first FSB-sized mapping of the buffer.

To recreate these conditions, this test fragments free space and
populates several directories with enough entries to require
discontiguous multi-block buffers. To recreate the problem, we
remove entries from the tail end of the directory and fsync to flush
the log.

Note that this test causes a panic on kernels affected by the bug.
As such, it is included in the 'dangerous' group. The bug is
resolved by kernel commit a3916e528b91 ("xfs: fix broken multi-fsb
buffer logging").

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/346: add to the quick and rw groups
Christoph Hellwig [Wed, 1 Jun 2016 12:38:26 +0000 (14:38 +0200)]
generic/346: add to the quick and rw groups

The test runs quickly and covers code not covered by any other test,
so add it to the quick group. Also add it to the rw group while
we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agooverlay: test memleak in copy-up error handling path
Xiong Zhou [Fri, 27 May 2016 06:13:00 +0000 (14:13 +0800)]
overlay: test memleak in copy-up error handling path

This memleak leads to panic when unmount the underlying fs.
Kernel commit ab79efab0 fixed this issue.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: clear of suid/sgid on direct write
Eryu Guan [Thu, 26 May 2016 05:59:48 +0000 (13:59 +0800)]
generic: clear of suid/sgid on direct write

Check that suid/sgid bits are cleared on direct write. XFS triggered
WARN_ON_ONCE in this case. Patchset from Jan Kara fixed the warning:

http://oss.sgi.com/archives/xfs/2014-12/msg00071.html

This test is inspired by a test case from Eric Sandeen, and follows
the test steps in generic/193. This test requires direct I/O, it's
not added to generic/193 but to a new test, so that generic/193
still runs on filesystems don't have direct I/O support.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric/250: ignore xfs_io IO errors when writing to dmerror device
Eryu Guan [Thu, 26 May 2016 03:26:24 +0000 (11:26 +0800)]
generic/250: ignore xfs_io IO errors when writing to dmerror device

When testing with data=journal ext4, direct write to dmerror device
doesn't return EIO, because ext4 turns direct write to buffered
write in data=journal mode and all data is written to journal
buffer. The write only fails later when commiting journal and error
messages can be seen in dmesg.

As the test is checking on the md5 checksum of the test file, it's
ok to ignore the IO error returned by xfs_io, as long as the
checksums match the golden image.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs: filter stripe width details from repair
Eric Sandeen [Thu, 19 May 2016 21:19:51 +0000 (16:19 -0500)]
xfs: filter stripe width details from repair

Several golden outputs have:

> Note - stripe unit (0) and width (0) fields have been reset.

but it's entirely possible for this to be non-zero,
which then fails to match and fails the test.

Filter this repair output and fix the golden files.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agocommon/rc: teach _require_xfs_io_command accept multi-parameters
Zorro Lang [Thu, 19 May 2016 04:30:59 +0000 (12:30 +0800)]
common/rc: teach _require_xfs_io_command accept multi-parameters

The $param can't be used for all command's options, for example
"help pwrite" include:

 -Z N -- zeed the random number generator (used when writing randomly)
         (heh, zorry, the -s/-S arguments were already in use in pwrite)

We should make param="-Z N", not only "-Z". After this patch, we can
run this function as:

  _require_xfs_io_command pwrite -Z N

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agodmerror: exclude dmerror tests with mount -o dax
Eric Sandeen [Thu, 19 May 2016 21:12:22 +0000 (16:12 -0500)]
dmerror: exclude dmerror tests with mount -o dax

Same as we do for dm flakey. dm can't do dax.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agobuild: avoid struct fsxattr redefinition
Jeffrey Bastian [Wed, 18 May 2016 17:40:54 +0000 (12:40 -0500)]
build: avoid struct fsxattr redefinition

Linux kernel v4.5 defines 'struct fsxattr' in linux/fs.h [0] but
it's still defined in xfs/linux.h as a backup [1].  If the files are
included in the wrong order, the compiler will complain with a
redefinition error.  This patch moves linux/fs.h (and linux/magic.h)
before the xfs headers for the t_immutable.c and fsstress.c tests.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=334e580a6f97e
[1] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfsprogs.git;a=blob;f=include/linux.h;h=cc0f70ceed72#l183

Signed-off-by: Jeffrey Bastian <jbastian@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: Test handling of private file mappings
Jan Kara [Thu, 12 May 2016 09:30:27 +0000 (11:30 +0200)]
generic: Test handling of private file mappings

Test handling of private file mappings in the kernel. Check that
writes of only one thread / process are seen in each page and that
none of these make it into the original file.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: check fiemap SHARED flag on sync
Qu Wenruo [Mon, 16 May 2016 01:14:15 +0000 (09:14 +0800)]
generic: check fiemap SHARED flag on sync

The test case will check SHARED flag returned by fiemap ioctl on
reflinked files before and after sync.

Normally SHARED flag won't change just due to a normal sync
operation.

But btrfs doesn't handle SHARED flag well, and this time it won't
check any delayed extent tree(reverse extent searching tree)
modification, but only metadata already committed to disk.

So btrfs will not return correct SHARED flag on reflinked files if
there is no sync to commit all metadata.

This testcase will just check it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: extent map search on dedupe file
Qu Wenruo [Mon, 23 May 2016 09:16:21 +0000 (17:16 +0800)]
generic: extent map search on dedupe file

For fully deduped file, which means all its file exntents are
pointing to the same bytenr, btrfs can cause soft lockup when
calling fiemap ioctl on that file, like the following output:
------
CPU: 1 PID: 7500 Comm: xfs_io Not tainted 4.5.0-rc6+ #2
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox
12/01/2006
task: ffff880027681b40 ti: ffff8800276e0000 task.ti: ffff8800276e0000
RIP: 0010:[<ffffffffa02583e4>]  [<ffffffffa02583e4>]
__merge_refs+0x34/0x120 [btrfs]
RSP: 0018:ffff8800276e3c08  EFLAGS: 00000202
RAX: ffff8800269cc330 RBX: ffff8800269cdb18 RCX: 0000000000000007
RDX: 00000000000061b0 RSI: ffff8800269cc4c8 RDI: ffff8800276e3c88
RBP: ffff8800276e3c20 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: ffff880026ea3cb0
R13: ffff8800276e3c88 R14: ffff880027132a50 R15: ffff880027430000
FS:  00007f10201df700(0000) GS:ffff88003fa00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f10201ec000 CR3: 0000000027603000 CR4: 00000000000406e0
Stack:
 0000000000000000 0000000000000000 0000000000000000 ffff8800276e3ce8
 ffffffffa0259f38 0000000000000005 ffff8800274c6870 ffff8800274c7d88
 0000000000c10000 0000000000000000 0000000000000001 0000000027431190
Call Trace:
 [<ffffffffa0259f38>] find_parent_nodes+0x448/0x740 [btrfs]
 [<ffffffffa025a4f2>] btrfs_check_shared+0x102/0x1b0 [btrfs]
 [<ffffffff811fdcad>] ? __might_fault+0x4d/0xa0
 [<ffffffffa021899c>] extent_fiemap+0x2ac/0x550 [btrfs]
 [<ffffffff811ce156>] ? __filemap_fdatawait_range+0x96/0x160
 [<ffffffffa01f8ee0>] ? btrfs_get_extent+0xb30/0xb30 [btrfs]
 [<ffffffffa01f5da5>] btrfs_fiemap+0x45/0x50 [btrfs]
 [<ffffffff81246bb8>] do_vfs_ioctl+0x498/0x670
 [<ffffffff81246e09>] SyS_ioctl+0x79/0x90
 [<ffffffff8184e997>] entry_SYSCALL_64_fastpath+0x12/0x6f
Code: 41 55 41 54 53 4c 8b 27 4c 39 e7 0f 84 e9 00 00 00 49 89 fd 49 8b
34 24 49 39 f5 48 8b 1e 75 17 e9 d5 00 00 00 49 39 dd 48 8b 03 <48> 89
de 0f 84 b9 00 00 00 48 89 c3 8b 46 2c 41 39 44 24 2c 75
------

Also btrfs will return wrong flag for all these extents, they should
have SHARED(0x2000) flags, while btrfs still consider them as
exclusive extents.

On the other hand, with unmerged xfs reflink patches, xfs can handle
it without problem, and for patched btrfs, it can also handle it.

This test case will create a large fully deduped file to check if
the fs can handle the fiemap ioctl and return correct SHARED flag
for any fs which support reflink.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agoxfs/133-4: filter redundant projid 0 quota report info out
Zorro Lang [Thu, 12 May 2016 02:55:19 +0000 (10:55 +0800)]
xfs/133-4: filter redundant projid 0 quota report info out

After GETNEXTQUOTA ioctl being supported, xfs_quota -c "report"
always outputs one more quota line about default quota (as project
ID 0). In order to fix this problem, xfsprogs has merged commit
3d607a1.

Now xfstests face this same problem from this issue. xfs/133 and
xfs/134 can't match their golden output, due to this one more line
quota report output. So this patch filters this redundant quota info
out.

There're 3 kinds of xfsprogs:
1. not support GETNEXTQUOTA
2. support GETNEXTQUOTA but not merged commit 3d607a1
3. the latest version supports all

The 1st one won't report Project ID 0, the 2nd will report projid 0
info as "(null) 0 0 0 ...", the 3rd will report projid 0 info as
"#0 0 0 0 ...". To deal with all of these situations, we will use

  _filter_quota | grep -v "^#0 \|^(null) "

But if someone specifies a name for projid 0, e.g.
  # cat $projid_file
  # root:0

I think that means someone wants to deal with it by himself, the
common filter won't filter it out.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
7 years agogeneric: renumber tests after merge
Dave Chinner [Mon, 9 May 2016 06:03:29 +0000 (16:03 +1000)]
generic: renumber tests after merge

Some tests were merged with high, non-conflicting test numbers
(700+). Renumber them down to contiguous numbers now that all the
other tests have been added, as it's easier to do it this way rather
than having to rebase and have to fix all the conflicts early
renumbering will cause.

Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agofstests: fix various $seqres.full issues
Eryu Guan [Mon, 9 May 2016 06:03:27 +0000 (16:03 +1000)]
fstests: fix various $seqres.full issues

There're many tests don't remove $seqres.full before writing to it, and
accumulating logs there, then the logs are always growing over time.
Let's fix them once.

generic/16[1-8] generic/170 and generic/33[34] truncate $seqres.full in
the middle of the test, which results in partial logs. Fix them as well.

xfs/227 has duplicated lines to remove $seqres.full, remove the extra
line.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add test for replacing a missing device
Omar Sandoval [Mon, 9 May 2016 00:58:06 +0000 (10:58 +1000)]
btrfs: add test for replacing a missing device

Now that _btrfs_get_profile_configs supports replace missing and the
kernel doesn't crash when replacing a missing RAID 5/6 device, test it.
Based on an earlier test from Wang Yanfeng.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: add replace missing and replace RAID 5/6 to profile configs
Omar Sandoval [Mon, 9 May 2016 00:57:50 +0000 (10:57 +1000)]
btrfs: add replace missing and replace RAID 5/6 to profile configs

Replacing and scrubbing RAID 5/6 is now supported on Btrfs. Enable it in
_btrfs_get_profile_configs while making it more generic to also support
replace missing.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: test creating a symlink and then fsync its parent directory
Filipe Manana [Mon, 9 May 2016 00:57:39 +0000 (10:57 +1000)]
generic: test creating a symlink and then fsync its parent directory

Test creating a symlink, fsync its parent directory, power fail and mount
again the filesystem. After these steps the symlink should exist and its
content must match what we specified when we created it (must not be
empty or point to something else).

This is motivated by an issue in btrfs where after the log replay happens
we get empty symlinks, which not only does not make much sense from a
user's point of view, it's also not valid to have empty links in linux
(wgich is explicitly forbidden by the symlink(2) system call).

The issue in btrfs is fixed by the following patch for the linux kernel:

  "Btrfs: fix empty symlink after creating symlink and fsync parent dir"

Tested against ext3, ext4, xfs, f2fs, reiserfs and nilfs2.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: Test that qgroup counts are valid after snapshot creation
Mark Fasheh [Mon, 9 May 2016 00:57:01 +0000 (10:57 +1000)]
btrfs: Test that qgroup counts are valid after snapshot creation

This has been broken since Linux v4.1. We may have worked out a solution on
the btrfs list but in the meantime sending a test to expose the issue seems
like a good idea.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agooverlay: test copy up by changing mode bits
Xiong Zhou [Mon, 9 May 2016 00:56:29 +0000 (10:56 +1000)]
overlay: test copy up by changing mode bits

Changing file attr in overlayfs triggers copy up.
Test this by changing mode bits then check both mode
bits and copy up results.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agooverlay: notrun if upper fs does not support d_type
Xiong Zhou [Mon, 9 May 2016 00:55:52 +0000 (10:55 +1000)]
overlay: notrun if upper fs does not support d_type

Overlayfs whiteout can be visible if underlying upper fs does not
support d_type. Kernel commit
45aebea (ovl: Ensure upper filesystem supports d_type)
prevents mounting overlayfs like this since v4.6-rc1.

Check upper fs before mounting overlay, mark as not run if needs.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agooverlay: test basic whiteout
Xiong Zhou [Mon, 9 May 2016 00:55:44 +0000 (10:55 +1000)]
overlay: test basic whiteout

Once a while, overlayfs whiteout can be visible if upper fs
does not support d_type(ftype/filetype). Test as a sanity
check on whiteout of regular files, links, dirs, devices
and pipes.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agodm-thinp demo test
Eric Sandeen [Mon, 9 May 2016 00:55:24 +0000 (10:55 +1000)]
dm-thinp demo test

Fairly trivial test to use the dm-thin infrastructure.

Right now it exhausts space in queue-on-error mode,
adds more space, does a bit more IO, then unmounts &
checks the fs.

Not sure if that's valid to test, but it works here and
demonstrates the common/dmthin helpers.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agodm-thinp helpers in common/dmthin
Eric Sandeen [Mon, 9 May 2016 00:55:13 +0000 (10:55 +1000)]
dm-thinp helpers in common/dmthin

Basic dm-thinp helpers to set up, tear down, grow, check,
and set no-space behavior for a single thin dm volume built
on $SCRATCH_DEV.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/038: Avoid EBUSY errors on umount
Jan Kara [Mon, 9 May 2016 00:54:48 +0000 (10:54 +1000)]
generic/038: Avoid EBUSY errors on umount

Although the test waits for running subshells after sending SIGTERM
signal to them, it does not wait for subprocesses of those subshells
properly. Thus we can hit EBUSY errors when umount is called. Make
subshells wait for executed subprocesses when receiving SIGTERM to avoid
the problem.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: Test races between processes doing mmap writes
Jan Kara [Mon, 9 May 2016 00:54:36 +0000 (10:54 +1000)]
generic: Test races between processes doing mmap writes

Add test which spawns two processes both writing one file via mmap.
Then to the test when processes first prefault the file by reading it
via mmap. This is mainly interesting to uncover races in DAX fault
handling.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: Test races between mmap and normal write for prefaulted ranges
Jan Kara [Mon, 9 May 2016 00:54:25 +0000 (10:54 +1000)]
generic: Test races between mmap and normal write for prefaulted ranges

Add test which spawns two threads both writing one file via mmap which
has been previously prefaulted by reading. Do the same test when one
thread accesses the file via mmap and the other one via normal write.
This is mainly interesting to uncover races in DAX fault handling and
between DAX fault handling and write path.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: Test races between mmap and normal writes
Jan Kara [Mon, 9 May 2016 00:54:10 +0000 (10:54 +1000)]
generic: Test races between mmap and normal writes

Add test which spawns two threads one writing to file via normal write
and one via mmap and checks the result. This is mainly interesting to
uncover races between DAX fault handling and write path.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/340: Remove second fallocate test
Jan Kara [Mon, 9 May 2016 00:53:18 +0000 (10:53 +1000)]
generic/340: Remove second fallocate test

Currently holetest program uses both posix_fallocate(3) and fallocate(3)
to setup the file. However this unnecessarily prolongs the test run and
doesn't really bring any additional code coverage. So remove the
fallocate(3) pass as using posix_fallocate(3) allows us to make the test
easily runnable even for filesystems not supporting that (such as ext2).

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agocommon/populate: remove unnecessary devices directory creation
Xiaoguang Wang [Mon, 9 May 2016 00:52:35 +0000 (10:52 +1000)]
common/populate: remove unnecessary devices directory creation

_scratch_ext4_populate and _scratch_xfs_populate try to create
devices directory in xfstests/, so if we run xfs/083 or ext4/006
twice, it'll fail, fix this issue.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs: test snapshot create with invalid parent qgroup
Mark Fasheh [Mon, 9 May 2016 00:51:48 +0000 (10:51 +1000)]
btrfs: test snapshot create with invalid parent qgroup

Test that an invalid parent qgroup does not cause snapshot create to
force the FS readonly.

In btrfs, create_pending_snapshot() will go readonly on _any_ error return
from
btrfs_qgroup_inherit(). If qgroups are enabled, a user can crash their fs by
just making a snapshot and asking it to inherit from an invalid qgroup.

This patch does exactly that test. If the FS goes readonly that will be
reported and we will know that a regression was introduced.

The btrfs fix this patch relates to can be found at the following url:
http://thread.gmane.org/gmane.comp.file-systems.btrfs/54755

Thanks,
--Mark

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/299: fix variable name typo
Zorro Lang [Mon, 9 May 2016 00:51:33 +0000 (10:51 +1000)]
xfs/299: fix variable name typo

In xfs/299, project IDs are in $tmp.projid file. But there's one
line code try to use $temp.projid. Fortunately, it doesn't bring
any problems until now, but if keep using $temp.projid it really
don't make sense.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoxfs/259: test more block sizes and handle minimum block size correctly
Eryu Guan [Mon, 9 May 2016 00:50:37 +0000 (10:50 +1000)]
xfs/259: test more block sizes and handle minimum block size correctly

Currently xfs/259 tests against TEST_DIR for CRC support status to
decide whether 512 block size should be tested, which is wrong for this
test, because configuration of TEST_DIR is not controlled by test
harness and can be different to the configuration being used in the
test.

Fix it by reversing the block size order that's tested and capture the
output of the actual mkfs command that is being tested, and determine if
512 byte block sizes should be tested based on that output.

While we're at it, I think the test matrix can be enlarged as well, 4k,
2k, 1k and 512 block size can be tested in each fs size boundary, not
only the minimum block size.

Suggested-by: Dave Chinner <dchinner@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>
7 years agoblock: test fallocate for block devices
Darrick J. Wong [Mon, 9 May 2016 00:49:50 +0000 (10:49 +1000)]
block: test fallocate for block devices

Now that we're wiring up fallocate's PUNCH_HOLE and ZERO_RANGE
features for block devices, add some tests to make sure they
work correctly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agobtrfs/091: Disable compress to avoid output dismatch
Qu Wenruo [Mon, 9 May 2016 00:46:14 +0000 (10:46 +1000)]
btrfs/091: Disable compress to avoid output dismatch

If run btrfs/091 with "-o compress=lzo" mount option, test case will
fail, as compress makes extent much smaller on disk, making output
different from golden output.

As this test case is only testing qgroup, not compression, disable
compression manually in test case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogitignore: add src/holetest
Omer Zilberberg [Mon, 9 May 2016 00:45:52 +0000 (10:45 +1000)]
gitignore: add src/holetest

Recently added 450d833 (generic/338: Add mmap race test) added a new
binary, it should be added to .gitignore as well.

Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric: test fsync after adding a link and moving other inode
Filipe Manana [Mon, 9 May 2016 00:45:20 +0000 (10:45 +1000)]
generic: test fsync after adding a link and moving other inode

Test that if we create a hard link for a file F in some directory A,
then move some directory or file B from its parent directory C into
directory A, fsync file F, power fail and mount the filesystem, the
directory/file B is located only at directory A and both links for
file F exist.

This test is motivated by an issue found in btrfs which is fixed by the
following patch for the linux kernel:

  Btrfs: fix for incorrect directory entries after fsync log replay

Tested against ext3/4, xfs, reiserfs and f2fs.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agogeneric/273: Remove hard coded block size
Chandan Rajendra [Mon, 9 May 2016 00:45:19 +0000 (10:45 +1000)]
generic/273: Remove hard coded block size

The space occupied by files in the 'origin' directory is calculated with
the assumption that 4k is the block size of the underlying filesystem.
This causes the test to fail with ENOSPC errors when running on
filesystems with larger block sizes. To fix the issue, this commit makes
use of the the block size obtained from the mounted filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
7 years agoconfig: git should ignore config files in config directory
Dave Chinner [Mon, 9 May 2016 00:43:29 +0000 (10:43 +1000)]
config: git should ignore config files in config directory

Running a git clean on a xfstests tree causes it to remove the
config files for the given host. Make git ignore custom config
files in this directory so git clean won't completely trash the
local config needed to run xfstests.

Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/082: filter out project quota status
Theodore Ts'o [Tue, 5 Apr 2016 01:49:34 +0000 (11:49 +1000)]
generic/082: filter out project quota status

In the most recent quota tools package, with the new project quota
support, quotaon -p prints an extra line which generic/082.out isn't
expecting.  So filter it out.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: Mark tests which use direct I/O with _requires_odirect
Theodore Ts'o [Tue, 5 Apr 2016 01:49:27 +0000 (11:49 +1000)]
common: Mark tests which use direct I/O with _requires_odirect

There were a number of tests that use Direct I/O that weren't testing
to make sure O_DIRECT is actually supported.  This will be important
for avoiding false positives when testing ext4 encryption (which does
not support DIO for obvious reasons).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoattr: adjust acl_max of f2fs if inline_xattr is set
Jaegeuk Kim [Tue, 5 Apr 2016 01:48:46 +0000 (11:48 +1000)]
attr: adjust acl_max of f2fs if inline_xattr is set

If f2fs gets inline_xattr, it enlarges the whole xattr space, which also enables
to cover more acl entries up to 531 from 506.
This patch detects the mount option, inline_xattr, and changes the result of
_acl_get_max for generic/026.

Fixes: 9f7bf79d0c34 ("attr: add maximum acl count for f2fs")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/030: filter out repeated lines from .out files
Eryu Guan [Tue, 5 Apr 2016 01:48:16 +0000 (11:48 +1000)]
xfs/030: filter out repeated lines from .out files

Commit 31f48569c353 ("xfs/030: fix output on newer filesystems") added
more lines to .out file to match the output from XFS with reflink
support, but it broke test on older XFS.

Dave explained the reason and pointed out the correct way to fix it, so
I just quote Dave's mail here:

"The problem here is that reflink triggers a change in the initial
population of the AGFL - from 4 blocks to 6 blocks, and so repair warns
6 times instead of 4. After filtering, that gives 6 indentical output
lines instead of 4.

Doing something as simple as collapsing repeated identical lines (e.g
filtering through uniq) will work for all filesystem formats and any
future changes that modify the initial AGFL population."

Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add test for fsync after renaming file
Filipe Manana [Tue, 5 Apr 2016 01:47:55 +0000 (11:47 +1000)]
generic: add test for fsync after renaming file

Test that if we rename a file, create a new file that has the old name
of the other file and is a child of the same parent directory, fsync the
new inode, power fail and mount the filesystem, we do not lose the first
file and that file has the name it was renamed to.

This test is motivated by an issue found in btrfs which is fixed by the
following patch for the linux kernel:

  "Btrfs: fix file loss caused by fsync after rename and new inode"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: add test for fsync after renaming directory
Filipe Manana [Tue, 5 Apr 2016 01:47:31 +0000 (11:47 +1000)]
generic: add test for fsync after renaming directory

Test that if we rename a directory, create a new file or directory that
has the old name of our former directory and is a child of the same
parent directory, fsync the new inode, power fail and mount the
filesystem, we see our first directory with the new name and no files
under it were lost.

This test is motivated by an issue found in btrfs which is fixed by the
following patch for the linux kernel:

  "Btrfs: fix file loss caused by fsync after rename and new inode"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/206: filter out reflink related outputs
Eryu Guan [Tue, 5 Apr 2016 01:47:02 +0000 (11:47 +1000)]
xfs/206: filter out reflink related outputs

Commit 13717ffc96fe ("xfs/206: fix output when mkfs knows about
reflink") added extra lines to xfs/206.out to fit the mkfs output with
reflink support, but broke tests without reflink support.

Fix it by filtering out reflink related outputs, just like filtering out
crc related outputs in the test.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/244: avoid creating too large random ID
Eryu Guan [Tue, 5 Apr 2016 01:46:31 +0000 (11:46 +1000)]
generic/244: avoid creating too large random ID

ppc64 hosts are generating too large random IDs like 725294314141253632,
which causes all sorts of errors in test.

Fix it by using format "-t uI" for 'int' size and it works fine on all
platforms.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: replace chattr with $CHATTR_PROG
Josef Bacik [Tue, 5 Apr 2016 01:46:12 +0000 (11:46 +1000)]
common: replace chattr with $CHATTR_PROG

We have a wrapper around chattr to make sure people don't do the wrong thing on
their boxes, so we need to be able to specify CHATTR_PROG and have it actually
work, so replace all chattr calls with $CHATTR_PROG.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: make results/check.log match everybody else
Josef Bacik [Tue, 5 Apr 2016 01:45:41 +0000 (11:45 +1000)]
check: make results/check.log match everybody else

results/check.log is inconsistent with what goes to stdout and $tmp.summary.  It
passes the ran and failed tests through fmt but not the "Not Run" tests for some
reason, and nobody else passes it through fmt.  So fix this to be the same
output as what goes to stdout and $tmp.summary to make for easier post parsing.
Now we'll get

Ran: <single line with all the tests>
Not run: <single line with all the not run tests>
Failures: <single line with all the failed tests>

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: add test for fsync after snapshot deletion
Filipe Manana [Tue, 5 Apr 2016 01:45:12 +0000 (11:45 +1000)]
btrfs: add test for fsync after snapshot deletion

Test that if we delete a snapshot, delete its parent directory, create
another directory with the same name as that parent and then fsync either
the new directory or a file inside the new directory, the fsync succeeds,
the fsync log is replayable and produces a correct result.

This is motivated by a bug that is fixed by the following patch for
btrfs (linux kernel):

  Btrfs: fix unreplayable log after snapshot deletion and parent
  re-creation

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocommon: make sure dm device is all settled before removing it
Eryu Guan [Tue, 5 Apr 2016 01:44:33 +0000 (11:44 +1000)]
common: make sure dm device is all settled before removing it

_dmerror_cleanup()/_cleanup_flakey may fail to remove dm device due to
EBUSY and cause subsequent tests to fail.

Fix it by calling $UDEV_SETTLE_PROG before remove dm device to make sure
no one is using it.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric/338: Add mmap race test
Jan Kara [Tue, 5 Apr 2016 01:44:05 +0000 (11:44 +1000)]
generic/338: Add mmap race test

Add test which spawns two threads racing to write to file via mmap and
checks the result. This is mainly interesting to uncover races in DAX
fault handling.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Brian Boylston <brian.boylston@hpe.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: test log replay with qgroups enabled and orphan roots
Filipe Manana [Tue, 5 Apr 2016 01:42:21 +0000 (11:42 +1000)]
btrfs: test log replay with qgroups enabled and orphan roots

Test that replaying a log tree when qgroups are enabled and orphan roots
(deleted snapshots) exist, the replay process does not crash.

This is motivated by a bug found in btrfs, introduced in the linux kernel
4.4 release, and is fixed by the linux kernel commit 909c3a22da3b
("Btrfs: fix loading of orphan roots leading to BUG_ON") that landed in
kernel 4.5.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agolib/tlibio: Fix a build warning
Satoru Takeuchi [Tue, 5 Apr 2016 01:41:40 +0000 (11:41 +1000)]
lib/tlibio: Fix a build warning

Remove the following warning message.

  ===============================
  tlibio.c: In function 'lio_set_debug':
  tlibio.c:212:1: warning: type of 'level' defaults to 'int' [-Wimplicit-int]
   lio_set_debug(level)
   ^
  ==============================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agooverlay/001: change supported fs from generic to overlay
Filipe Manana [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
overlay/001: change supported fs from generic to overlay

The supported fs was set to generic by mistake, so fix it by setting it
to the proper type 'overlay'.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agocheck: catch general protection fault traces in _check_dmesg
Filipe Manana [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
check: catch general protection fault traces in _check_dmesg

While writing a test case for overlayfs I noticed that _check_dmesg()
did not detect general protection fault traces like the following:

[15277.026108] run fstests overlay/002 at 2016-03-21 18:42:27
[15277.933179] general protection fault: 0000 [#11] PREEMPT SMP DEBUG_PAGEALLOC
[15277.935427] Modules linked in: btrfs overlay ppdev crc32c_generic evdev xor raid6_pq psmouse pcspkr sg serio_raw acpi_cpufreq parport_pc parport tpm_tis i2c_piix4
[15277.936011] CPU: 15 PID: 22762 Comm: xfs_io Tainted: G      D         4.5.0-rc6-btrfs-next-26+ #1
[15277.936011] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by qemu-project.org 04/01/2014
[15277.936011] task: ffff88001f6f1340 ti: ffff88000a3f8000 task.ti: ffff88000a3f8000
[15277.936011] RIP: 0010:[<ffffffffa030b7ab>]  [<ffffffffa030b7ab>] btrfs_sync_file+0x11b/0x3e9 [btrfs]
[15277.936011] RSP: 0018:ffff88000a3fbe40  EFLAGS: 00010286
[15277.936011] RAX: 0000000080000000 RBX: ffff8800b0152c88 RCX: 0000000000000001
[15277.936011] RDX: 0000000000000001 RSI: ffffffff8148fec0 RDI: 00000000ffffffff
[15277.936011] RBP: ffff88000a3fbec0 R08: 0000000000000001 R09: 0000000000000000
[15277.936011] R10: ffff88000a3fbe40 R11: 0000000000000246 R12: 6e756f635f657269
[15277.936011] R13: 0000000000000000 R14: 00000000014655a0 R15: ffff88017dd25e40
[15277.936011] FS:  00007f27f0e1f700(0000) GS:ffff88023ede0000(0000) knlGS:0000000000000000
[15277.936011] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[15277.936011] CR2: 00007f27f0e2f000 CR3: 000000013aadf000 CR4: 00000000000006e0
[15277.936011] Stack:
[15277.936011]  ffffffff8108b5cc ffff88000a3fbec0 0000000000000246 ffff880125abaed0
[15277.936011]  ffff8800b0152d60 8000000000000000 7fffffffffffffff 0000000000000246
[15277.936011]  0000000000000246 ffffffff81074f9b ffffffff8104357c ffff88017dd25e40
[15277.936011] Call Trace:
[15277.936011]  [<ffffffff8108b5cc>] ? arch_local_irq_save+0x9/0xc
[15277.936011]  [<ffffffff81074f9b>] ? ___might_sleep+0xce/0x217
[15277.936011]  [<ffffffff8104357c>] ? __do_page_fault+0x3c0/0x43a
[15277.936011]  [<ffffffff811a2351>] vfs_fsync_range+0x8c/0x9e
[15277.936011]  [<ffffffff811a237f>] vfs_fsync+0x1c/0x1e
[15277.936011]  [<ffffffff811a24d6>] do_fsync+0x31/0x4a
[15277.936011]  [<ffffffff811a2700>] SyS_fsync+0x10/0x14
[15277.936011]  [<ffffffff81493617>] entry_SYSCALL_64_fastpath+0x12/0x6b
[15277.936011] Code: 85 c0 0f 85 e2 02 00 00 48 8b 45 b0 31 f6 4c 29 e8 48 ff c0 48 89 45 a8 48 8d 83 d8 00 00 00 48 89 c7 48 89 45 a0 e8 fc 43 18 e1 <f0> 41 ff 84 24
[15277.936011] RIP  [<ffffffffa030b7ab>] btrfs_sync_file+0x11b/0x3e9 [btrfs]
[15277.936011]  RSP <ffff88000a3fbe40>
[15277.974598] ---[ end trace 721e14960eb939c1 ]---

So teach it to look out for such traces.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agooverlayfs: test fsync on merged directory
Filipe Manana [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
overlayfs: test fsync on merged directory

Test that calling fsync against a file using the merged directory does
not result in a crash nor fails unexpectedly.

This is motivated by a change in overlayfs that resulted in a crash
(invalid memory access) when the lower or upper directory belonged to
a btrfs file system. The overlayfs change came in commit 4bacc9c9234
(overlayfs: Make f_path always point to the overlay and f_inode to the
underlay). At the moment there are two patches in the linux-fsdevel
and linux-btrfs mailing lists to fix this problem:

  * vfs: add file_dentry()
  * Btrfs: fix crash/invalid memory access on fsync when using overlayfs

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs: 'subvolume stress' tasks need to exit gracefully
Chandan Rajendra [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
btrfs: 'subvolume stress' tasks need to exit gracefully

The following scenario can occur when running btrfs/066,

  Task A                                Task B                     Task C

  run_test()
  - Execute _btrfs_stress_subvolume()
    in a background shell.
                                        _btrfs_stress_subvolme()
                                          ...
                                        - fork & exec "mount"
                                                          Mount subvolume on directory in $TEST_DIR
  - Wait for fsstress to finish                                    do_mount()
  - kill shell process executing                                   - btrfs_mount()
    _btrfs_stress_subvolume()
    i.e. Task B.
  - Init process becomes the parent
    of "subvolume mount" task
    i.e. Task C.
  - In case subvolume is mounted
    (which is not the case),
    unmount it.
                                                                   - Complete mounting subvolume

Hence on the completion of one iteration of run_test(), the subvolume
created inside the filesystem on $SCRATCH_DEV continues to be mounted on
$TEST_DIR/$seq.mnt. Subsequent invocations of run_test() (called for
remaining Btrfs profile configs) fail during _scratch_pool_mkfs.

Instead of killing the 'subvolume stress' task this commit makes
_btrfs_stress_subvolume() to break out of the loop when a file exists
on the filesystem. The commit also makes relevant changes to other
users of _btrfs_stress_subvolume() i.e. btrfs/060, btrfs/065,
btrfs/067 & btrfs/068.

Suggested-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/073: avoid finobt warning from mkfs
Eryu Guan [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
xfs/073: avoid finobt warning from mkfs

When testing xfs/073 with MKFS_OPTIONS="-m crc=1,finobt=1" set, it fails
due to extra warning about disabling finobt feature:

 +warning: finobt not supported without CRC support, disabled.

Because xfs/073 disables crc unconditionally and finobt can not be
enabled either.

Fix it by explicitly disabling finobt as well.

Also remove all meta related mkfs options in _scratch_mkfs_xfs_opts() if
mkfs.xfs has no metadata support, not only the crc option. So that test
still passes on distros with such old binaries.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/191: Remove obsolete nfs4acl tests
Andreas Gruenbacher [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
xfs/191: Remove obsolete nfs4acl tests

The nfs4acl tests don't make sense anymore as they have been obsoleted
by richacls.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoRename output file templates to match TEST.out*
Andreas Gruenbacher [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
Rename output file templates to match TEST.out*

Rename the expected output files so that they match "$TEST_NAME.out*";
this makes the file names a bit more consistent.

Add $TEST_NAME.out and similar symlinks to .gitignore.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofstests: make xfs/006 generic
Eryu Guan [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
fstests: make xfs/006 generic

xfs/006 has no requirements that are specific to XFS, so make it generic
and other filesystems could get some coverage too.

Along with the movement, I also added a test that removes all created
dirs, as that's how the original bug was found.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/059: add a filter for btrfs compression property
Wang Xiaoguang [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
btrfs/059: add a filter for btrfs compression property

btrfs/059.out should not be hardcoded to zlib, if compression method
is lzo, this case will fail wrongly, so here add a filter.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agogeneric: test I/O on dm error device
Eryu Guan [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
generic: test I/O on dm error device

This is a test that performs simple I/O on dm error device, which
returns EIO on all I/O request.

This is motivated by an ext4 bug that crashes kernel on error path when
trying to update atime. Following kernel patch should fix the issue

  ext4: fix NULL pointer dereference in ext4_mark_inode_dirty()

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/209: filter scratch dir properly
Christoph Hellwig [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
xfs/209: filter scratch dir properly

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: remove NOCOW_FL testing from test
Darrick J. Wong [Wed, 23 Mar 2016 06:39:11 +0000 (17:39 +1100)]
xfs: remove NOCOW_FL testing from test

Since XFS dropped support for the NOCOW_FL flag, cut it out of the tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: test per-ag allocation accounting during truncate-caused refcountbt expansion
Darrick J. Wong [Wed, 23 Mar 2016 06:39:09 +0000 (17:39 +1100)]
xfs: test per-ag allocation accounting during truncate-caused refcountbt expansion

Ensure that refcountbt allocations during truncate operations come
from the per-AG reservation and are not charged to the transaction.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/122: support rmapxbt
Darrick J. Wong [Wed, 23 Mar 2016 06:37:32 +0000 (17:37 +1100)]
xfs/122: support rmapxbt

Support the extended rmap btree key structure.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/122: define _GNU_SOURCE when compiling test program
Darrick J. Wong [Wed, 23 Mar 2016 06:37:32 +0000 (17:37 +1100)]
xfs/122: define _GNU_SOURCE when compiling test program

This makes it so we don't get warnings about off64_t not being
defined when compiling the test program.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/073: fix output
Darrick J. Wong [Wed, 23 Mar 2016 06:37:32 +0000 (17:37 +1100)]
xfs/073: fix output

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
8 years agoxfs/030: fix output on newer filesystems
Darrick J. Wong [Wed, 23 Mar 2016 06:37:32 +0000 (17:37 +1100)]
xfs/030: fix output on newer filesystems

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/206: fix output when mkfs knows about reflink
Darrick J. Wong [Wed, 23 Mar 2016 06:37:32 +0000 (17:37 +1100)]
xfs/206: fix output when mkfs knows about reflink

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/23[3-6]: don't source common/xfs, it doesn't exist
Darrick J. Wong [Wed, 23 Mar 2016 06:37:31 +0000 (17:37 +1100)]
xfs/23[3-6]: don't source common/xfs, it doesn't exist

Don't source common/xfs, since it doesn't (yet) exist.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoreflink: fix fragmentation tests to work on >4k block size filesystems
Darrick J. Wong [Wed, 23 Mar 2016 06:37:31 +0000 (17:37 +1100)]
reflink: fix fragmentation tests to work on >4k block size filesystems

For tests that only overwrite part of a file, only consider the number
of extents in the *rewritten* blocks when deciding if the FS
fragmentation performance is satisfactory.

(Also slip in a fix for xfs/127 so that it formats correctly when we
specify big blocksizes via MKFS_OPTIONS.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs: test copy-on-write leftover recovery
Darrick J. Wong [Wed, 23 Mar 2016 06:37:29 +0000 (17:37 +1100)]
xfs: test copy-on-write leftover recovery

Test recovery of CoW leftovers in xfs_repair.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agoxfs/207: fix golden output to match FS_IOC_FSSETXATTR hoist
Darrick J. Wong [Wed, 23 Mar 2016 03:36:09 +0000 (14:36 +1100)]
xfs/207: fix golden output to match FS_IOC_FSSETXATTR hoist

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agobtrfs/048: user filter for property error messages
David Sterba [Wed, 23 Mar 2016 03:35:25 +0000 (14:35 +1100)]
btrfs/048: user filter for property error messages

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
8 years agofilter.btrfs: new filter for property messages
David Sterba [Wed, 23 Mar 2016 03:35:14 +0000 (14:35 +1100)]
filter.btrfs: new filter for property messages

The error message in newer btrfs utilities contains name of the
property, we want to filter it out so it matches golden output. There's
an optional parameter with property name that is matched against the
command output.

Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>