xfstests-dev.git
5 years agoxfs/288: shut up verifier error
Darrick J. Wong [Fri, 5 Oct 2018 00:19:39 +0000 (17:19 -0700)]
xfs/288: shut up verifier error

Ignore the verifier errors when we fuzz hdr.count to zero.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/270: use _scratch_xfs_set_metadata_field to fuzz rocompat bits
Darrick J. Wong [Fri, 5 Oct 2018 00:19:33 +0000 (17:19 -0700)]
xfs/270: use _scratch_xfs_set_metadata_field to fuzz rocompat bits

Use the helper to set the metadata field so that we can bypass write
verifier checks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/189: skip 'barrier' mount option test on newer kernels
Darrick J. Wong [Fri, 5 Oct 2018 00:19:26 +0000 (17:19 -0700)]
xfs/189: skip 'barrier' mount option test on newer kernels

Starting in Linux 4.19 the 'barrier' and 'nobarrier' mount options were
removed.  If mount complains about a bad option when we remount with
'barrier', just skip the test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: test mount time summary counter check and fix
Darrick J. Wong [Fri, 5 Oct 2018 00:19:20 +0000 (17:19 -0700)]
xfs: test mount time summary counter check and fix

Tests to ensure that the xfs mount code can detect obviously bad fs
summary counters at mount time and fix them.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: another mread-after-eof test
Darrick J. Wong [Fri, 5 Oct 2018 00:19:14 +0000 (17:19 -0700)]
generic: another mread-after-eof test

Add Brian Foster's alternate reproducer code for the mread-after-eof
problem so that we increase the chances that either this or generic/499
will catch the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneirc/077: fix min size for btrfs
Anand Jain [Thu, 11 Oct 2018 07:55:28 +0000 (15:55 +0800)]
geneirc/077: fix min size for btrfs

If btrfs need to be tested at its default blockgroup which is non-mixed,
then it needs at least 256mb.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test for file fsync after moving it to a new parent directory
Filipe Manana [Tue, 9 Oct 2018 14:05:35 +0000 (15:05 +0100)]
generic: test for file fsync after moving it to a new parent directory

Test that if we move a file from a directory B to a directory A, replace
directory B with directory A, fsync the file and then power fail, after
mounting the filesystem the file has a single parent, named B and there
is no longer any directory with the name A.

This test is motivated by a bug found in btrfs which is fixed by a patch
for the linux kernel titled:

  "Btrfs: fix wrong dentries after fsync of file that got its parent
   replaced"

This test passes on ext4, xfs and patched btrfs but it hangs on f2fs (the
fsck.f2fs process seems stuck).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test mounting filesystem after fsync of a tmpfile
Filipe Manana [Mon, 8 Oct 2018 10:13:13 +0000 (11:13 +0100)]
generic: test mounting filesystem after fsync of a tmpfile

Test that if we fsync a tmpfile, without adding a hard link to it, and
then power fail, we will be able to mount the filesystem without
triggering any crashes, warnings or corruptions.

This test is motivated by an issue in btrfs where this scenario triggered
a warning (without any side effects). The following linux kernel patch
fixes the issue in btrfs:

  "Btrfs: fix warning when replaying log after fsync of a tmpfile"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/rc: fix check for yp
Johannes Thumshirn [Fri, 12 Oct 2018 11:50:55 +0000 (13:50 +0200)]
common/rc: fix check for yp

Only testing if a domainname is set and ypcat is installed is not a
sufficient criteria to check if NIS is actually active.

Check for a running ypbind in rpcinfo as well.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/reflink: fix error messages in _require_scratch_dedupe()
Anthony Iliopoulos [Wed, 10 Oct 2018 23:55:50 +0000 (01:55 +0200)]
common/reflink: fix error messages in _require_scratch_dedupe()

In case dedupe returns an error in _require_scratch_dedupe(),
report the error for the scratch rather than for the test
filesystem.

Signed-off-by: Anthony Iliopoulos <ailiopoulos@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoext4/018: fix mismatch wildcard with debugfs
Yufen Yu [Thu, 11 Oct 2018 13:14:10 +0000 (21:14 +0800)]
ext4/018: fix mismatch wildcard with debugfs

For the new version of debugfs(v1.44.0+), it changes "File ACL:" format
from "%sFile ACL: %llu    Directory ACL: %d\n" to "%sFile ACL: %llu\n".

Thus, update this case accordingly.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test creation time recovery after power failure
Chao Yu [Sun, 7 Oct 2018 12:25:48 +0000 (20:25 +0800)]
generic: test creation time recovery after power failure

After fsync, filesystem should guarantee inode metadata including
creation time being persisted, so even after sudden power-cut, during
mount, we should recover i_crtime_{,nsec} fields correctly, in order
to not loss those meta info.

So adding this testcase to check whether generic filesystem can
guarantee that.

Note that, it needs inode creation time support on specified filesystem.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test i_flags recovery after power failure
Chao Yu [Sun, 7 Oct 2018 12:25:47 +0000 (20:25 +0800)]
generic: test i_flags recovery after power failure

After fsync, filesystem should guarantee inode metadata including
i_flags being persisted, so even after sudden power-cut, during
mount, we should recover i_flags fields correctly, in order to not
loss those meta info.

So adding this testcase to check whether generic filesystem can
guarantee that.

We only check below attribute modification which most filesystem
supports:
- no atime updates (A)
- secure deletion (s)
- synchronous updates (S)
- undeletable (u)

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test project id recovery after power failure
Chao Yu [Sun, 7 Oct 2018 12:25:46 +0000 (20:25 +0800)]
generic: test project id recovery after power failure

After fsync, filesystem should guarantee inode metadata including
project id being persisted, so even after sudden power-cut, during
mount, we should recover project_id fields correctly, in order to
not loss those meta info.

So adding this testcase to check whether generic filesystem can
guarantee that.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/387: fix _scratch_mkfs_sized option for btrfs
Anand Jain [Tue, 25 Sep 2018 04:24:22 +0000 (12:24 +0800)]
generic/387: fix _scratch_mkfs_sized option for btrfs

btrfs needs 256mb to create a fs with default block group which is
non mixed, so pass 256mb to _scratch_mkfs_sized().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/449: fix fs size for _scratch_mkfs_sized for btrfs
Anand Jain [Tue, 25 Sep 2018 04:24:21 +0000 (12:24 +0800)]
generic/449: fix fs size for _scratch_mkfs_sized for btrfs

btrfs needs 256m to create btrfs with default options like non mixed
block groups.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/083: fix btrfs fs size for default mode
Anand Jain [Tue, 25 Sep 2018 04:24:17 +0000 (12:24 +0800)]
generic/083: fix btrfs fs size for default mode

btrfs needs at least 256mb to create a FS with the defaults options.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/015: fix to test the default non-mixed mode
Anand Jain [Tue, 25 Sep 2018 04:24:15 +0000 (12:24 +0800)]
generic/015: fix to test the default non-mixed mode

commit 97575acd7495 (generic/015: Change the test filesystem size to
101mb), created 101mb FS instead of 100mb FS to make sure we create
a FS which is non mixed mode.

btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device
size check) added a more accurate minimum required space to create
the btrfs FS in non mixed mode depending on the group profile, and
considering any group profiles we would need at least 256MB (with
upward round off).

So this patch changes the FS size to be created by
_scratch_sized_mkfs() to 256MB so that we create the FS in non mixed
mode for any group profile.

Mixed blockgroup can be tested using the MKFS_OPTIONS explicitly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: _scratch_mkfs_sized fix min size without mixed option
Anand Jain [Tue, 25 Sep 2018 04:24:14 +0000 (12:24 +0800)]
btrfs: _scratch_mkfs_sized fix min size without mixed option

As of now _scratch_mkfs_sized() checks if the requested size is
below 1G and forces the --mixed option for the mkfs.btrfs. Well the
correct size considering all possible group profiles at which we
need to force the mixed option is roughly 256Mbytes. So fix that.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test unaligned punch hole at ENOSPC
Anand Jain [Sun, 30 Sep 2018 01:39:52 +0000 (09:39 +0800)]
btrfs: test unaligned punch hole at ENOSPC

Try to punch hole with unaligned size and offset when the FS is
full. Mainly holes are punched at locations which are unaligned
with the file extent boundaries when the FS is full by data.
As the punching holes at unaligned location will involve
truncating blocks instead of just dropping the extents, it shall
involve reserving data and metadata space for delalloc and so data
alloc fails as the FS is full.

btrfs_punch_hole()
 btrfs_truncate_block()
   btrfs_check_data_free_space() <-- ENOSPC

We don't fail punch hole if the holes are aligned with the file
extent boundaries as it shall involve just dropping the related
extents, without truncating data extent blocks.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/122: add struct xfs_unmount_log_format
Eric Sandeen [Thu, 4 Oct 2018 17:27:32 +0000 (12:27 -0500)]
xfs/122: add struct xfs_unmount_log_format

struct xfs_unmount_log_format used to be anonymous and gained a name
in 4.19, so add that to the list of expected structures in xfs/122.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/quota: adapt _require_prjquota() for f2fs
Chao Yu [Sun, 30 Sep 2018 09:26:53 +0000 (17:26 +0800)]
common/quota: adapt _require_prjquota() for f2fs

In _require_prjquota(), let's check project quota support as below
for f2fs:

- For image support, check 'project_quota' on enabled feature list
  of specified device.
- For kernel support, check /sys/fs/f2fs/features/project_quota
  sysfs entry status.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/108: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:42 +0000 (20:49 +0530)]
generic/108: work with 64k block size

This commit increases the size of the scsi debug device to 300MiB to
accommodate a 275MiB sized XFS filesystem with 64k block size. mkfs.xfs
fails to create a 64k block sized filesystem on devices with capacity
less than 275MiB.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/018: to work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:41 +0000 (20:49 +0530)]
generic/018: to work with 64k block size

This commit replaces the hard coded bsize variable with the block size
obtained from the underlying filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/459: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:40 +0000 (20:49 +0530)]
generic/459: work with 64k block size

With 64k block size, 200MiB disk space is not sufficient to create an
XFS filesystem. Hence this commit increases the size of the
overprovisioned dm-thin device to 300MiB. The commit also increases the
other associated disk sizes (original physical size and new physical
size) appropriately.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/235: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:39 +0000 (20:49 +0530)]
generic/235: work with 64k block size

With 64k blocksized filesystem, this test fails since a single 8k write
will actually end up consuming 64k. Hence this commit writes 64k data
into the test file.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/230: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:38 +0000 (20:49 +0530)]
generic/230: work with 64k block size

This commit changes the test to work on file offsets that are aligned
with the block size of the underlying filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/177: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:37 +0000 (20:49 +0530)]
generic/177: work with 64k block size

This commit changes the test to work on file offsets that are aligned
with the block size of the underlying filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/punch: Filter fiemap output by FS block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:36 +0000 (20:49 +0530)]
common/punch: Filter fiemap output by FS block size

When testing FS instances of block size other than 4k, the output of
fiemap command will not match those in *.out files. This commit adds
an optional "block size" argument to _filter_fiemap() which prints
fiemap output in units of block size.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/172: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:35 +0000 (20:49 +0530)]
generic/172: work with 64k block size

For 64k block size, With 256MiB as the XFS filesystem size and 168 MiB
as the size of the clone source file, we end up hitting ENOSPC when
cloning the source file. This happens due to lack of space for housing
the corresponding metadata. This scenario also occurs when using a
512MiB XFS filesystem and 300MiB clone source file.

Hence this commit increases the size of the test filesystem to 1 GiB and
the size of the clone source file to 768MiB.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/102: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:34 +0000 (20:49 +0530)]
generic/102: work with 64k block size

With 64k block size, mkfs.xfs fails with the following message when the
filesystem size is 512MiB in size,

"log size 2037 blocks too small, minimum size is 2473 blocks"

Hence this commit increases the test filesystem size to 1GiB. Also, the
size of the test file is increased to 800MiB which is ~80% of the test
filesystem size. This is in proportion to the 400MiB test file used with
the original 512MiB test filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/325: Inject free_extent error after CoW operation
Chandan Rajendra [Mon, 24 Sep 2018 15:19:33 +0000 (20:49 +0530)]
xfs/325: Inject free_extent error after CoW operation

On a 64k blocksized filesystem, when the test CoWs the file2's offset
range [10 * 64k, 19 * 64k], the call to xfs_bmapi_reserve_delalloc()
allocates 32 64k blocks. This is because XFS_DEFAULT_COWEXTSZ_HINT has
the value of 32 and xfs_get_cowextsz_hint() uses this to compute the
extent alignment. This leads to xfs_bmapi_reserve_delalloc() to reserve
space corresponding to the file range [0, 32 * 64k] in the inode's
cow fork area. On completion of write I/O corresponding to file2's range
[10 * 64k, 19 * 64k], xfs_end_io() moves 10 out of the originally
allocated 32 64k blocks to the data fork area. The remaining 22 64k
blocks linger on in cow fork area of the inode.

Later, when servicing the exit() syscall for the xfs_io process,
xfs_free_eofblocks() ends up invoking xfs_reflink_cancel_cow_blocks()
since i_delayed_blks has the value 22. xfs_reflink_cancel_cow_blocks()
indirectly invokes __xfs_free_extent() which returns EIO since
XFS_ERRTAG_FREE_EXTENT has been set. This leads to the filesystem to be
shutdown. The "rm" command invoked later ends up returning an
error and hence the test fails. The test actually requires that the
filesystem gets shutdown when executing the "rm" command.

To fix the problem, this commit injects the free_extent error after we
CoW file2's [10 * 64k, 19 * 64k] range.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/299: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:32 +0000 (20:49 +0530)]
xfs/299: work with 64k block size

This commit changes the test to calculate quota limits based on the
block size of the underlying filesystem. Also, the sizes of the test
files are now made to be a multiple of the filesystem block size.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/299: Fix "Push past soft inode limit" case
Chandan Rajendra [Mon, 24 Sep 2018 15:19:31 +0000 (20:49 +0530)]
xfs/299: Fix "Push past soft inode limit" case

The test sets an inode soft limit of four but only three files are
created. This commit creates two more files in order to really push past
the soft inode limit.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/190: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:30 +0000 (20:49 +0530)]
xfs/190: work with 64k block size

This commit describes "file hole" ranges in multiples of block sizes
rather than using constants.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/140: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:29 +0000 (20:49 +0530)]
xfs/140: work with 64k block size

For 64k block size, the agsize provided in the test causes mkfs.xfs to
fail due to insufficient log space. Hence this commit computes agsize
based on block size of the filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/139: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:28 +0000 (20:49 +0530)]
xfs/139: work with 64k block size

For 64k block size, the agsize provided in the test causes mkfs.xfs to
fail due to insufficient log space. Hence this commit computes agsize
based on block size of the filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/127: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:27 +0000 (20:49 +0530)]
xfs/127: work with 64k block size

With reflink feature enabled, we require atleast 500MiB of
disk space to create a filesystem with 64k block size. Hence this commit
sets the size of the scratch filesystem to 512MiB.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/074: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:26 +0000 (20:49 +0530)]
xfs/074: work with 64k block size

This commit makes file and extent size calculations to be a function of
the filesystem's block size. It also adds a brief description of the
bug that is being tested.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/050: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:25 +0000 (20:49 +0530)]
xfs/050: work with 64k block size

This commit changes the test to calculate quota limits based on the
block size of the underlying filesystem. Also, the sizes of the test
files are now made to be a multiple of the filesystem block size.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/050: Fix "Push past soft inode limit" case
Chandan Rajendra [Mon, 24 Sep 2018 15:19:24 +0000 (20:49 +0530)]
xfs/050: Fix "Push past soft inode limit" case

The test sets an inode soft limit of four but only three files are
created. This commit creates two more files in order to really push past
the soft inode limit.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/009: work with 64k block size
Chandan Rajendra [Mon, 24 Sep 2018 15:19:23 +0000 (20:49 +0530)]
xfs/009: work with 64k block size

xfs_alloc_file_space() rounds up allocation requests by the filesystem
block size. Hence this commit changes the test to work with block size
units rather than with a multiple of 4096 bytes.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test uid/gid recovery after power failure
Chao Yu [Tue, 25 Sep 2018 08:45:58 +0000 (16:45 +0800)]
generic: test uid/gid recovery after power failure

After fsync, filesystem should guarantee inode metadata including
uid/gid being persisted, so even after sudden power-cut, durign
mount, we should recover uid/gid fields correctly, in order to not
loss those meta info.

So adding this testcase to check whether generic filesystem can
guarantee that.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/270: allow corrupted xfs_db write
Eric Sandeen [Tue, 25 Sep 2018 18:16:16 +0000 (13:16 -0500)]
xfs/270: allow corrupted xfs_db write

Upcoming verifiers treat the unknown ro_compat flag written via xfs_db
as corruption, so use the -d flag to allow it, and filter our the
resulting informational message.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agofstests: fix _test_generic_punch() to fit 64k extent
Anand Jain [Wed, 12 Sep 2018 07:48:44 +0000 (15:48 +0800)]
fstests: fix _test_generic_punch() to fit 64k extent

14 test cases use _test_generic_punch(), and they work well as long
as the ext4/xfs blocksize or btrfs sectorsize is below 4K.

In the system with 64K pagesize, as the blocksize can be upto 64K or the
sectorsize can be 64K so 13/14 test cases fail, because the
test-file-size (20k) and thus the extent boundary offsets aren't
big enough to fit the larger than 4k extent size.

Commit 2f194e4e820e6acfcfdadf9f488a162b22db9d86 (generic/009: don't run
for btrfs if PAGE_SIZE > 4096) tried to address this by calling the
not_run in generic/009.

And in the function _test_generic_punch() we use multiple=4 to address
the similar problem but its limited to the subcommand fcollapse.

Now to run these test cases successfully on systems with pagesize 64k,
this patch propose to increase the default multiple=1 to multiple=16.
With this we increase the test file size from 20k to 320k and thus it
encapsulates maximum extent size of 64k here. And we can drop the
multiple=4 which is just being done similar for the cases of fcollapse
subcommand only. And it appears to me there is no harm in increasing
the file size and offsets in general for all commands instead of just
fcollapse command.

This change is tested on ext4, xfs and btrfs on system with pagesize
4K and 64K.

With this patch, these 14 test cases runs fine on system with 64K
pagesize as well as pagesize 4K. However we may hit the same
limitation at some point when we want to validate the FSs with
pagesizes -gt 64K. And this patch does not address that part as of
now.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/rc: fix check for disabled kmemleak
Amir Goldstein [Sat, 22 Sep 2018 15:23:39 +0000 (18:23 +0300)]
common/rc: fix check for disabled kmemleak

With kernel commit b353756b2b71 ("kmemleak: always register debugfs
file") that was merged to v4.19-rc3, the kmemleak debugfs knob
exists even if kmemleak is disabled, but returns EBUSY on write.

Suppress EBUSY errors in tests by disabling _check_kmemleak() calls
if the write to kmemleak knob failed on _init_kmemleak().

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs/149: make it sectorsize independent
Anand Jain [Sun, 16 Sep 2018 10:52:08 +0000 (18:52 +0800)]
btrfs/149: make it sectorsize independent

Originally this test case was designed to work with 4K sectorsize.
Now enhance it to work with any sector sizes and makes the following
changes:
.out file not to contain any traces of sector size.
Use max_inline=0 mount option so that it meets the requisite of non inline
regular extent.
Don't log the md5sum results to the output file as the data size vary by
the sectorsize.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoshared/010: avoid dedupe testing blocked on large fs
Zorro Lang [Wed, 12 Sep 2018 10:15:47 +0000 (18:15 +0800)]
shared/010: avoid dedupe testing blocked on large fs

When test on large fs (--large-fs), xfstests preallocates a large
file in SCRATCH_MNT/ at first. Duperemove will take too long time
to deal with that large file (many days on 500T XFS). So move
working directory to a sub-dir underlying $SCRATCH_MNT/.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/498: don't call _cleanup_flakey repeatedly
Lu Fengqi [Tue, 4 Sep 2018 06:26:50 +0000 (14:26 +0800)]
generic/498: don't call _cleanup_flakey repeatedly

Since exit always traps into _cleanup function which contains
_cleanup_flakey, don't need _cleanup_flakey twice.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agotmpfs: don't require {TEST|SCRATCH}_DEV
Miklos Szeredi [Mon, 3 Sep 2018 12:27:28 +0000 (14:27 +0200)]
tmpfs: don't require {TEST|SCRATCH}_DEV

tmpfs doesn't require a device and the source argument of the mount
is ignored.  If {TEST|SCRATCH}_DEV is not given then set them to
proper strings.

[Eryu: don't require SCRATCH_DEV too]

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/504: Check inode number accurately
Xiao Yang [Mon, 3 Sep 2018 09:36:20 +0000 (17:36 +0800)]
generic/504: Check inode number accurately

If inode number is equal to the line number of locks which is
first column in /proc/locks, generic/504 will match wrong number
and get PASS. For example:
-----------------------------------------------------------
inode 12
...
12: FLOCK  ADVISORY  WRITE 1615 00:2e:37889 0 EOF
-----------------------------------------------------------

We should match correct inode number by six column in /proc/locks.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/009: fix test failure with overlay over ext4
Amir Goldstein [Mon, 27 Aug 2018 18:29:26 +0000 (21:29 +0300)]
generic/009: fix test failure with overlay over ext4

When running test with overlayfs and ext4 as base fs, we need to
disable extent zeroout on the underlying base fs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agooverlay: do not set OVL_BASE_FSTYP value to "overlay"
Amir Goldstein [Mon, 27 Aug 2018 18:29:25 +0000 (21:29 +0300)]
overlay: do not set OVL_BASE_FSTYP value to "overlay"

The purpose of OVL_BASE_FSTYP is to store the value of FSTYP that is
found in a host config file section.

When there is no host config file or if user sets FSTYP=overlay in config
file, it makes no sense to store the value "overlay" in OVL_BASE_FSTYP
and it is better to leave it empty or leave its current value in tact.

This allows user to set OVL_BASE_FSTYP in config file or before running
the test to support queries about base fs, such as
_require_metadata_journaling, even when running an overlay test.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agosrc/seek_sanity_test: skip test20 if file's too big
Luis Henriques [Mon, 27 Aug 2018 13:12:11 +0000 (14:12 +0100)]
src/seek_sanity_test: skip test20 if file's too big

Since the allocation size can be quite big for some filesystems
(4194304 for cephfs), the pwrite operation in test20 may fail with
EFBIG.  Skip this test if that's the case.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agooverlay/016: split into two tests
Amir Goldstein [Fri, 24 Aug 2018 04:40:44 +0000 (07:40 +0300)]
overlay/016: split into two tests

overlay/016 tests two cases of ro/rw fd data inconsistecies -
one using pread and one using mmap read (i.e. mread).

The first case now passes with stacked overlay file operations
patch set merged. The second case will still fail.

By splitting the two test cases we get one regression test for
the common case of ro/rw fd data inconsistecy with pread and
one test to track the remaining non-standard behavior of
overlayfs w.r.t mmap.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoopen_by_handle: fix name of directory in error messages
Amir Goldstein [Fri, 24 Aug 2018 04:27:55 +0000 (07:27 +0300)]
open_by_handle: fix name of directory in error messages

dirname() modifies the string in dname, but we use that string
in error messages later on to print the test dir name.
Make another copy of test_dir for passing to dirname().

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agofstests: filter redundant output by getfattr
Zorro Lang [Thu, 23 Aug 2018 02:41:24 +0000 (10:41 +0800)]
fstests: filter redundant output by getfattr

When getfattr dumps values of all extended attributes (-d option),
it doesn't print empty extended attributes. e.g: user.name. But from
attr-2.4.48 this behavior is changed,  new getfattr prints
user.name="".

The {=""} will break the golden image, so filter the redundant =""
at the end if it has.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agofstests: Fix buffer alignment of aiocp
Xiao Yang [Wed, 15 Aug 2018 05:41:45 +0000 (13:41 +0800)]
fstests: Fix buffer alignment of aiocp

In generic/252, aiocp with DIRECT will fail and return EINVAL on
4096 sector size block device, because the default 512 alignment
defined in aiocp is not aligned with 4096.

Please see the following error:
----------------------------------------------------------
read missing bytes expect 8388608 got -22
----------------------------------------------------------

We use '-a' option to specify a proper alignment size in all tests
that call aiocp with DIRECT.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: Add test for corrupted childless qgroup numbers
Qu Wenruo [Mon, 13 Aug 2018 05:22:05 +0000 (13:22 +0800)]
btrfs: Add test for corrupted childless qgroup numbers

This bug is exposed by populating a high level qgroup, and then make
it childless with old qgroup numbers, and finally do rescan.

Normally rescan should zero out all qgroups' accounting number, but
due to a kernel bug which won't mark childless qgroups dirty, their
on-disk data is never updated, thus old numbers remain and cause
qgroup corruption.

Fixed by the following kernel patch:
"btrfs: qgroup: Dirty all qgroups before rescan"

[Eryu: removed useless _filter_xfs_io]

Reported-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: show locks info owned by dead process
Xiong Murphy Zhou [Thu, 9 Aug 2018 07:53:53 +0000 (15:53 +0800)]
generic: show locks info owned by dead process

Regression test case for kernel patchset:
    fs/lock: show locks info owned by dead/invisible processes

Open new fd by exec shell built-in, then require exclusive lock
by flock(1) command. Checking /proc/locks for the lock info.

This patchset post by Konstantin Khorenko <khorenko@virtuozzo.com>
has not been merged v4.18-rc8.

[Eryu: require $FLOCK_PROG and add more comments]

Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/288: notrun if xfs_db write command fails
Zorro Lang [Fri, 10 Aug 2018 03:26:32 +0000 (11:26 +0800)]
xfs/288: notrun if xfs_db write command fails

Old xfsprogs can't change attr hdr.count to 0 on v5 filesystems, two
reasons maybe cause this issue:

1) This commit has been merged: 89baf918(xfs_db: write values into
   dir/attr blocks and recalculate CRCs).
2) xfs_db write command doesn't support -d option.

That's not a real bug, so skip this test if xfs_db can't set attr
hdr.count to 0.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/228: fix restoration of kernel.core_pattern sysctl
Omar Sandoval [Thu, 9 Aug 2018 21:40:12 +0000 (14:40 -0700)]
generic/228: fix restoration of kernel.core_pattern sysctl

generic/228 changes kernel.core_pattern, so it saves it beforehand in
order to restore it. However, it adds an extra space in the process:

$ echo \"$(sysctl kernel.core_pattern | awk -F = '{print $NF}')\"
" |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e"

Instead of using awk, just use sysctl -n to only print the value.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agosrc/stat_test: fix undefined reference to `xfstests_statx'
Lu Fengqi [Tue, 7 Aug 2018 12:35:51 +0000 (20:35 +0800)]
src/stat_test: fix undefined reference to `xfstests_statx'

Since glibc 2.28 has added the statx function after commit
fd70af45528d ("Add the statx function"), stat_test.c will include
/usr/include/bits/statx.h eventually by "include <sys/stat.h>". That
causes the STATX_TYPE has already been defined before include
"status.h", then xfstests_statx will not be defined.

So make fails with the following error message:

/usr/bin/ld: /tmp/cc2Isfch.o: in function `main':
/home/luke/workspace/xfstests-dev/src/stat_test.c:690: undefined reference to `xfstests_statx'
/usr/bin/ld: /tmp/cc2Isfch.o: in function `get_reference':
/home/luke/workspace/xfstests-dev/src/stat_test.c:301: undefined reference to `xfstests_statx'
/usr/bin/ld: /tmp/cc2Isfch.o: in function `main':
/home/luke/workspace/xfstests-dev/src/stat_test.c:642: undefined reference to `xfstests_statx'

Just move out the definition of xfstests_statx between "#ifndef
STATX_TYPE" and "#endif /* STATX_TYPE */".

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test writing into unwritten extent right before snapshotting
Filipe Manana [Mon, 6 Aug 2018 08:08:39 +0000 (09:08 +0100)]
btrfs: test writing into unwritten extent right before snapshotting

Test that if we write into an unwritten extent of a file when there
is no more space left to allocate in the filesystem and then
snapshot the file's subvolume, after a clean shutdown the data was
not lost.

This test is motivated by a bug found by Robbie Ko for which there
is a fix whose patch title is:

  "Btrfs: fix unexpected failure of nocow buffered writes after
   snapshotting when low on space"

Reported-by: Robbie Ko <robbieko@synology.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: test inode allocation state missmatch corruption
Zorro Lang [Mon, 30 Jul 2018 07:15:51 +0000 (15:15 +0800)]
xfs: test inode allocation state missmatch corruption

There's a situation where the directory structure and the inobt
thinks the inode is free, but the inode on disk thinks it is still
in use. XFS should detect it and prevent the kernel from oopsing on
lookup.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs/057: Update test case to keep subvolume in any kernel version
Misono Tomohiro [Fri, 3 Aug 2018 06:44:37 +0000 (15:44 +0900)]
btrfs/057: Update test case to keep subvolume in any kernel version

Since commit a79a464d5675 ("btrfs: Allow rmdir(2) to delete an empty
subvolume"), rm -r can delete a subvolume too.

This test assumes that rm -r does not delete a subvolume.
Currently the commit does not affect the test since qgroup items
still exist after subvolume deletion, but we plan to change the
behavior and remove them along with subvolume deletion.

So update the test and keep subvolume (and qgroup item) in any kernel
version.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test send with prealloc extent beyond EOF and hole punching
Filipe Manana [Mon, 30 Jul 2018 11:40:17 +0000 (12:40 +0100)]
btrfs: test send with prealloc extent beyond EOF and hole punching

Test that an incremental send operation produces correct results if
a file that has a prealloc (unwritten) extent beyond its EOF gets a
hole punched in a section of that prealloc extent.

This test is motivated by a bug found in btrfs which is fixed by a
patch for the linux kernel titled:

 "Btrfs: send, fix incorrect file layout after hole punching beyond eof"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/288: use -d option of xfs_db write command for v5 XFS
Zorro Lang [Sun, 29 Jul 2018 14:20:53 +0000 (22:20 +0800)]
xfs/288: use -d option of xfs_db write command for v5 XFS

The commit b3cf8b72334fd35ef961869506e5a72ab398bc82 update xfs/288
to support v5 filesystem testing. That commit thought xfs_db write
command can work well with -d option on V5 XFS. But the truth is the
case doesn't use that option.

So turn to use _scratch_xfs_set_metadata_field, it will help to use
proper options for xfs_db write command.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test DAX DMA vs truncate/hole-punch
Ross Zwisler [Fri, 27 Jul 2018 21:12:52 +0000 (15:12 -0600)]
generic: test DAX DMA vs truncate/hole-punch

This adds a regression test for the following series:

[PATCH v4 0/2] ext4: fix DAX dma vs truncate/hole-punch
https://lists.01.org/pipermail/linux-nvdimm/2018-July/016842.html

which adds synchronization between DAX DMA in ext4 and truncate/hole-punch.
The intention of the test is to test those specific changes, but it runs
fine both with XFS and without DAX so I've put it in the generic tests
instead of ext4 and not restricted it to only DAX configurations.

When run with v4.18-rc6 + DAX + ext4, this test will hit the following
WARN_ON_ONCE() in dax_disassociate_entry():

WARN_ON_ONCE(trunc && page_ref_count(page) > 1);

If you change this to a WARN_ON() instead, you can see that each of the
four paths being exercised in this test hits that condition many times in
the one second that the subtest is being run.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test send with snapshots that have files deleted while open
Filipe Manana [Mon, 23 Jul 2018 08:11:03 +0000 (09:11 +0100)]
btrfs: test send with snapshots that have files deleted while open

Test that we are able to do send operations when one of the source
snapshots (or subvolume) has a file that is deleted while there is
still a open file descriptor for that file.

This test is motivated by a bug found in btrfs which is fixed by a patch
for the linux kernel titled:

  "Btrfs: fix send failure when root has deleted files still open"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: add test for fsync after renaming hard links of same file
Filipe Manana [Thu, 19 Jul 2018 18:02:20 +0000 (19:02 +0100)]
generic: add test for fsync after renaming hard links of same file

Test that if we have a file with 2 (or more) hard links in the same
parent directory, rename of the hard links, rename one of the other
hard links to the old name of the hard link we renamed before,
create a new file in the same parent directory with the old name of
second hard link we renamed, fsync fsync this new file and power
fail, we will be able to mount again the filesystem and the new file
and all hard links exist.

This test is motivated by a bug found in btrfs, where mounting the
filesystem after the power failure resulted in failure with an errno
value of EEXIST, which is fixed by a patch for the linux kernel
titled:

  "Btrfs: fix mount failure after fsync due to hard link recreation"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobuild: replace lowercase letters regex with POSIX character class in Makefile
Zorro Lang [Thu, 19 Jul 2018 10:03:49 +0000 (18:03 +0800)]
build: replace lowercase letters regex with POSIX character class in Makefile

Latest glibc changed some rules of sorting and regexes, the usage
likes "[a-z]" maybe not only stand for lowcase letters a..z in
different locale. Similar issues include [A-Z], [0-9] and so on.

For example, in en_US.UTF-8 locale, [a-z] means aAbBcCdD...zZ, it
stands for both of uppercase and lowercase. Currently this issue
cause `make install` fails on system with new glibc.

So use POSIX character class to instead of [...] group, something
likes [:lower:], [:upper:], [:alpha:], [:alnum:], etc... are common.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agosrc/: add license and copyright info to files
Ross Zwisler [Tue, 10 Jul 2018 22:09:41 +0000 (16:09 -0600)]
src/: add license and copyright info to files

Add copyright and license info to files that I've authored in src/.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
5 years agogeneric: add test for fsync after cloning file range
Filipe Manana [Thu, 12 Jul 2018 00:38:11 +0000 (01:38 +0100)]
generic: add test for fsync after cloning file range

Test that if we do a buffered write to a file, fsync it, clone a
range from another file into our file that overlaps the previously
written range, fsync the file again and then power fail, after we
mount again the filesystem, no file data was lost or corrupted.

This test is motivated by a bug found in btrfs, which is fixed by a
patch for the linux kernel titled:

  "Btrfs: fix file data corruption after cloning a range and fsync"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon: filter out quota regeneration messages
Darrick J. Wong [Wed, 4 Jul 2018 04:51:31 +0000 (21:51 -0700)]
common: filter out quota regeneration messages

Filter out quota regeneration messages from xfs_repair when we check
the filesystem, because the xfs tests that encode xfs_repair output
in the golden output will fail when quotas are enabled and the
xfs_repair quota messages appear.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/338: don't check fs after crashing it
Darrick J. Wong [Wed, 4 Jul 2018 04:51:25 +0000 (21:51 -0700)]
generic/338: don't check fs after crashing it

This test tries to make the filesystem go down by setting up
dm-error and committing metadata updates.  Since the test doesn't
remount the fs after it goes down to recover the log, this can
result in a dirty log being presented to the post-test filesystem
check if the filesystem is xfs and quotas are enabled.

Since this is a regression test for a NULL pointer dereference in
the kernel after the fs goes down, simply skip the post-test fsck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/288: update for v5 filesystem support in xfs_db
Darrick J. Wong [Wed, 4 Jul 2018 04:51:18 +0000 (21:51 -0700)]
xfs/288: update for v5 filesystem support in xfs_db

The xfs_db 'write -d' command has supported v5 filesystems for a few
releases now, and there's nothing about this test that require v4,
so let the test run with v5 if the user so specifies.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/001: update to handle v5 filesystems
Darrick J. Wong [Wed, 4 Jul 2018 04:51:06 +0000 (21:51 -0700)]
xfs/001: update to handle v5 filesystems

xfs/001 fuzzes various extent fields using xfs_db.  There's nothing
in it that's specific to v4 filesystems, so upgrade the test to be
able to handle v5 filesystems.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/{279, 28[1-3]}: hide SIGBUS reporting from golden output
Darrick J. Wong [Wed, 4 Jul 2018 04:50:53 +0000 (21:50 -0700)]
generic/{279, 28[1-3]}: hide SIGBUS reporting from golden output

These four tests check that mmap'd cow writes fail when the
filesystem goes down.  For regular filesystems the msync reports
EIO, but if quotas are enabled on xfs the write itself terminates
xfs_io with a SIGBUS.  We don't care how the write fails, so don't
let the SIGBUS report escape to the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: test dm-thin running out of data space vs concurrent discard
Zorro Lang [Thu, 12 Jul 2018 05:08:50 +0000 (13:08 +0800)]
generic: test dm-thin running out of data space vs concurrent discard

If a user constructs a test that loops repeatedly over below steps
on dm-thin, block allocation can fail due to discards not having
completed yet (Fixed by a685557 dm thin: handle running out of data
space vs concurrent discard):

1) fill thin device via filesystem file
2) remove file
3) fstrim

And this maybe cause a deadlock (fast device likes ramdisk can help
a lot) when racing a fstrim with a filesystem (XFS) shutdown. (Fixed
by 8c81dd46ef3c Force log to disk before reading the AGF during a
fstrim)

This case can reproduce both two bugs if they're not fixed. If only
the dm-thin bug is fixed, then the test will pass. If only the fs
bug is fixed, then the test will fail. If both of bugs aren't fixed,
the test will hang.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon/xfs: remove bad xfs_repair -t option
Zorro Lang [Tue, 10 Jul 2018 09:41:29 +0000 (17:41 +0800)]
common/xfs: remove bad xfs_repair -t option

The xfs_repair "-t" option shouldn't be used alone. An interval must
follow the -t option, or xfs_repair will report errors. And only
modify reporting interval is useless, if we don't enable ag_stride.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric/499: filter fsx stderr output
Zorro Lang [Tue, 10 Jul 2018 12:52:43 +0000 (20:52 +0800)]
generic/499: filter fsx stderr output

On some old kernel which supports COLLAPSE_RANGE and ZERO_RANGE, but
doesn't support INSERT_RANGE, this case alway fails as:

   QA output created by 499
  +main: filesystem does not support fallocate mode FALLOC_FL_INSERT_RANGE, disabling!
   Silence is golden

fsx print one more line to break the golden image.

To fix this issue, redirect both fsx stdout and stderr to a file,
then check the return value.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: fuzz every field of every structure and test kernel crashes
Darrick J. Wong [Fri, 6 Jul 2018 14:41:46 +0000 (07:41 -0700)]
xfs: fuzz every field of every structure and test kernel crashes

Fuzz every field of every structure and then try to write the
filesystem, to see how many of these writes can crash the kernel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agonfs/001: ignore the header in nfs4_getfacl output
Scott Mayhew [Fri, 6 Jul 2018 15:37:38 +0000 (11:37 -0400)]
nfs/001: ignore the header in nfs4_getfacl output

nfs4-acl-tools commit 6630629bb661 ("nfs4_getfacl: Add support to
accept more paths") added a header to the nfs4_getfacl output.  Make
sure the test is only counting the number of ACEs.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: skip copy fs test on large device
Zorro Lang [Fri, 6 Jul 2018 06:07:28 +0000 (14:07 +0800)]
xfs: skip copy fs test on large device

When test on large SCRATCH_DEV, copy a huge size XFS to TEST_DIR
will fill the TEST_DIR soon, and xfs_copy process will be blocked
there. Due to copy LARGE_SCRATCH_DEV won't add any more test
coverage, so skip this kind of tests if LARGE_SCRATCH_DEV is yes.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agogeneric: mread past eof shows nonzero contents
Darrick J. Wong [Wed, 4 Jul 2018 04:50:30 +0000 (21:50 -0700)]
generic: mread past eof shows nonzero contents

Certain sequences of generic/127 invocations complain about being
able to mread nonzero contents past eof.  Replicate that here as a
regression test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs/262: remove -y parameter
Liu Yiding [Thu, 5 Jul 2018 01:37:03 +0000 (09:37 +0800)]
xfs/262: remove -y parameter

Since commit 66f7b4c2ce14 ("xfs_scrub: remove -y parameter") has
removed parameter -y, -y is an invalid option.

Signed-off-by: Liu Yiding <liuyd.fnst@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobuild: fix undefined macro: AC_PACKAGE_NEED_GETXATTR_LIBATTR
Lu Fengqi [Mon, 2 Jul 2018 07:00:01 +0000 (15:00 +0800)]
build: fix undefined macro: AC_PACKAGE_NEED_GETXATTR_LIBATTR

Because the macro AC_PACKAGE_NEED_GETXATTR_LIBATTR was removed by
the following commit specified by fixes tag, we also need remove
AC_PACKAGE_NEED_GETXATTR_LIBATTR from configure.ac.

In addition, the libattr will not be set after the macro being
removed. This cause gcc fail to link the libattr for fsstress
correctly. The macro AC_PACKAGE_NEED_ATTRGET_LIBATTR has been
obsoleted, so change it to AC_PACKAGE_NEED_ATTRSET_LIBATTR and add
it to configure.ac. It can help check libattr and set libattr
variable.

Fixes: 42b851446ff1 ("build: remove <attr/xattr.h> check")
Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Tested-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobuild: remove <attr/xattr.h> check
Lu Fengqi [Wed, 27 Jun 2018 10:18:54 +0000 (18:18 +0800)]
build: remove <attr/xattr.h> check

Since fsstress and src/t_immutable don't need attr/xattr.h, just
remove <attr/xattr.h> and getxattr(2) check.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agosrc/t_immutable: use sys/xattr.h instead of attr/xattr.h
Lu Fengqi [Wed, 27 Jun 2018 10:18:53 +0000 (18:18 +0800)]
src/t_immutable: use sys/xattr.h instead of attr/xattr.h

Since attr v2.4.48 has removed <attr/xattr.h>, use <sys/xattr.h>
provided by glibc.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agofsstress: remove include <attr/xattr.h>
Lu Fengqi [Wed, 27 Jun 2018 10:18:52 +0000 (18:18 +0800)]
fsstress: remove include <attr/xattr.h>

Since commit de6d86177ff8 ("QA test updates - fixes for pquota,
extsize, fsstress, and ensure mount options passed through to
test_dev. Merge of master-melb:xfs-cmds:24763a by kenmcd.") remove
llistxattr from fsstress, xattr.h is useless.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test if btrfs will corrupt nodatasum compressed extent when replacing device
Qu Wenruo [Thu, 14 Jun 2018 06:30:53 +0000 (14:30 +0800)]
btrfs: test if btrfs will corrupt nodatasum compressed extent when replacing device

This is a long existing bug (from 2012) but exposed by a reporter
recently, that when compressed extent without data csum get written
to device-replace target device, the written data is in fact
uncompressed data other than the original compressed data.

And since btrfs still consider the data is compressed and will try
to read it as compressed, it can cause read error.

This is fixed by kernel commit ac0b4145d662 ("btrfs: scrub: Don't
use inode pages for device replace")

Reported-by: James Harvey <jamespharvey20@gmail.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobuild: fix install target using sudo
Luis R. Rodriguez [Wed, 27 Jun 2018 16:03:55 +0000 (09:03 -0700)]
build: fix install target using sudo

If you install with:

sudo make install

Depending on the system, you may see that /var/lib/xfstests/
installed properly but /var/lib/xfstests/tests/ is empty and so your
install really is broken and not functional. Finding out what went
wrong is not obvious.

The issue is caused due to the fact that $(PWD) is used nad if sudo
is used this can be empty on some systems.

PWD is only used on one target on the xfstests build system, the
tests/*/ dir install target.

We can fix this by using $(CURDIR) instead.

This issue is observed on both Fedora and OpenSUSE, but not on
Debian.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Suggested-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: test bad character in xfs_db field list selector string
Zorro Lang [Wed, 27 Jun 2018 16:59:57 +0000 (00:59 +0800)]
xfs: test bad character in xfs_db field list selector string

Bad characters likes tailing asterisk, slash or quote in xfs_db
field string can trigger a xfs_db crash. This bug has been fixed by
xfsprogs commit 945e47e2fcc5 ("xfs_db: fix crash when field list
selector string has trailing slash").

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agobtrfs: test power failure while qgroups rescan is in progress
Filipe Manana [Tue, 26 Jun 2018 23:43:27 +0000 (00:43 +0100)]
btrfs: test power failure while qgroups rescan is in progress

Test that if a power failure happens on a filesystem with quotas
(qgroups) enabled while the quota rescan kernel thread is running,
we will be able to mount the filesystem after the power failure.

This test is motivated by a recent regression introduced in the
linux kernel's 4.18 merge window and is fixed by a patch with the
title:

  "Btrfs: fix mount failure when qgroup rescan is in progress"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agocommon: Add _dmsetup_create and _dmsetup_remove helpers
Xiao Yang [Thu, 28 Jun 2018 01:45:34 +0000 (09:45 +0800)]
common: Add _dmsetup_create and _dmsetup_remove helpers

Make sure both "$UDEV_SETTLE_PROG" and "mknodes" can always
be run after a dm create or remove operation.

Suggested-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoshared: dedupe with random io race test
Zorro Lang [Sat, 23 Jun 2018 18:00:29 +0000 (02:00 +0800)]
shared: dedupe with random io race test

Run several duperemove processes with fsstress on same directory at
same time. Make sure the race won't break the fs or kernel.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoshared: iterate dedupe integrity test
Zorro Lang [Sat, 23 Jun 2018 18:00:28 +0000 (02:00 +0800)]
shared: iterate dedupe integrity test

This case does dedupe on a dir, then copy the dir to next dir.
Dedupe the next dir again, then copy this dir to next again, and
dedupe again ... At the end, verify the data in the last dir is
still same with the first one.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoshared: dedupe a single big file and verify integrity
Zorro Lang [Sat, 23 Jun 2018 18:00:27 +0000 (02:00 +0800)]
shared: dedupe a single big file and verify integrity

Duperemove is a tool for finding duplicated extents and submitting
them for deduplication, and it supports XFS. This case trys to
verify the integrity of XFS after running duperemove.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
5 years agoxfs: Test root inode parent pointer repairing
Marco Benatto [Fri, 22 Jun 2018 18:03:57 +0000 (15:03 -0300)]
xfs: Test root inode parent pointer repairing

Recently we found out xfs_repair were not repairing root inode
parent pointer when root inode is on short-form and parent points to
an invalid inode number (refer to: "xfs_repair: Fix root inode's
parent when it's bogus for sf directory" on xfs-devel list).

This test checks if xfs_repair successfully repair the filesystem in
the scenario mentioned before.

Signed-off-by: Marco Benatto <mbenatto@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>