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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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.
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().
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.
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>
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.
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.
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.
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.
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().
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.
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.
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"
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.
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 */".
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>
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>
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.
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:
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>
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.
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"
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"
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.
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"
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>
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>
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>
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>
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>
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.
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>
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.
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>
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>
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>
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.
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>
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>
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>
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"
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.
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.
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>
Darrick J. Wong [Fri, 22 Jun 2018 06:40:42 +0000 (23:40 -0700)]
xfs: regression test for rmapbt fdblocks accounting problems
In "xfs: fix fdblocks accounting w/ RMAPBT per-AG reservation", we fixed
the per-ag reservation code so that we always decrease fdblocks by the
reserved size because rmapbt blocks are counted as free space.
The primary symptom of this bug is that if the rmapbt has expanded since
mount time, the disk block counters reported via statfs will change
across a remount. Therefore, we exercise this 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>
Darrick J. Wong [Thu, 21 Jun 2018 18:32:35 +0000 (11:32 -0700)]
xfs/365: fuzz inobt in ag 1
In kernel patch "xfs: verify root inode more thoroughly", we strengthen
the root inode mount checks to make sure that the inobt agrees that the
root inode exists and is in use. Unfortunately, that makes this whole
test useless because we can't even mount the filesystem to run scrub.
So, redirect it to AG1's inobt.
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>
Dave Chinner [Wed, 20 Jun 2018 02:04:16 +0000 (12:04 +1000)]
src/: spdx license conversion
Mostly scripted like all the others, manually added tags to
Makefile, nsexec.c and t_mmap_writev.c. Manually touched up
open_by_handle.c and t_encrypted_d_revalidate.c post script.
Notes for future reference:
- src/log-writes/ code has no explicit copyright or license tags,
nor does the upstream repository, hence license is unknown.
Need Josef to clarify the license and send a patch adding SPDX
tags to those files.
- src/perf code has no explicit copyright or license tags, but it
was code submitted explictly for fstests so it is assumed to be
GPLv2.0 and tagged as such. If this is incorrect, Josef will need
to clarify copyright and the license and send patches to correct
it.
Dave Chinner [Wed, 20 Jun 2018 02:04:15 +0000 (12:04 +1000)]
src/aio-dio-regress/: spdx license conversion
The license headers all had to be manually editted into a consistent
format, then converted to spdx tags via scripting. Manually added
tag to Makefile.
Notes for future reference and research:
- quoted source repositories for aio-dio suite no longer exist
- src/aio-dio-regress/aiodio_sparse2.c has no explicit license
statement, so need to find original source to determine actual
license before tagging.
Ross Zwisler [Wed, 20 Jun 2018 22:51:46 +0000 (16:51 -0600)]
src: fix up mmap() error checking
I noticed that in some of my C tests in src/ I was incorrectly
checking for mmap() failure by looking for NULL instead of
MAP_FAILED. Fix those and clean up some places where we were
testing against -1 (the actual value of MAP_FAILED) which was
manually being cast to a pointer.
Marco Benatto [Mon, 18 Jun 2018 17:44:32 +0000 (14:44 -0300)]
common/xfs: Add _scratch_get_sfdir_prefix function
Move get_sfdir_prefix function from xfs/278 to commom/xfs
and rename it to _scratch_get_sfdir_prefix so it can be
used in other xfs tests.
This commit also changes xfs/278 to make use of
_scratch_get_sfdir_prefix instead previous one.
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>
Xiao Yang [Wed, 20 Jun 2018 03:12:00 +0000 (11:12 +0800)]
src/t_stripealign.c: Fix complier error
The FIEMAP_EXTENT_SHARED flag was added into kernel since commit 8c0414cd524e, so undefined FIEMAP_EXTENT_SHARED resulted in complier
error on old distros(e.g. RHEL6), as below:
----------------------------------------------------------------------
t_stripealign.c:99: error: 'FIEMAP_EXTENT_SHARED' undeclared (first use in this function)
----------------------------------------------------------------------
We fix it by defining the flag manually.
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Zorro Lang [Mon, 11 Jun 2018 09:10:40 +0000 (17:10 +0800)]
xfs/170: increase agsize for bigger internal log size
xfs/170 always fails on xfs with "-m rmapbt=1,reflink=1", because
XFS need bigger internal log size if rmapbt and reflink are both
enabled.
One line of xfs/170 as below:
_test_streams 8 16 4 8 3 0 0
Refer to common/filestreams, we can see xfs/170 trys to create a
128M XFS (agcount=8, agsize=16M), then each stream writes
24M (8 * 3M files), and there're 4 streams.
So the case expects each stream takes 2 AGs, 4 streams takes
different 8 AGs just enough. But internal log will break this
balance. For example:
And the internal log is in the 4th AG:
# xfs_logprint: /dev/mapper/xxxx-xfscratch
xfs_logprint:
data device: 0xfd03
log device: 0xfd03 daddr: 131120 length: 24600
# xfs_db -c "convert daddr 131120 agno" /dev/mapper/xxxx-xfscratch
0x4 (4)
Then if one stream write data into AG-1 at first, then turn to AG-4
after fill 16M agsize. But AG-4 has 12M space for log section, so
only 4M free space for data. Then this stream have to turn to the
next AG after fill the 4M space. All these as below:
# xfs_bmap -vp stream2-dir/*
stream2-dir/frame-1:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..6143]: 32960..39103 1 (192..6335) 6144 000000
...
...
stream2-dir/frame-5:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..6143]: 57536..63679 1 (24768..30911) 6144 000000
stream2-dir/frame-6:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..6143]: 155776..161919 4 (24704..30847) 6144 000000
stream2-dir/frame-7:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..6143]: 170088..176231 5 (6248..12391) 6144 000000
stream2-dir/frame-8:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..6143]: 176232..182375 5 (12392..18535) 6144 000000
Later _test_streams maybe takes AG-5 again, and cause two streams use
AG-5. To avoid this failure, increase the agsize from 16M to 22M,
others stay the same, each stream still writes 2 AGs. Even internal
log takes some space from someone AG, left space should be enough to
write (24 - 22)=2M data.
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>
Darrick J. Wong [Wed, 13 Jun 2018 22:50:57 +0000 (15:50 -0700)]
generic/223: port t_stripealign to FIEMAP
Since XFS has deprecated FIBMAP on FSDAX filesystems, we can't use
FIBMAP to verify stripe alignment anymore. FIEMAP has existed for
quite some time now, so port it to use that instead, and only fall
back to FIBMAP if FIEMAP doesn't exist.
Tested-by: ross.zwisler@linux.intel.com Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Hou Tao [Tue, 12 Jun 2018 12:43:30 +0000 (20:43 +0800)]
ltp/fsx: output the seed value after logid is initialized
When running multiple fsx processes simultaneously (e.g.
generic/455), it is difficult to tell the seed value for one fsx
process if the seed value is needed to reproduce a log-replay
failure.
Fix it by outputting the seed value after logid is initialized.
Filipe Manana [Mon, 11 Jun 2018 18:24:35 +0000 (19:24 +0100)]
generic: add test for fsync of directory after creating hard link
Test that if we create a new hard link for a file which was
previously fsync'ed, fsync a parent directory of the new hard link
and power fail, the parent directory exists after mounting the
filesystem again. The parent directory must be a new directory, not
yet persisted.
This test is motivated by a bug found in btrfs, where the fsync'ed
parent directory was lost after a power failure. The bug in btrfs is
fixed by a patch for the linux kernel titled:
Dave Chinner [Sat, 9 Jun 2018 01:36:01 +0000 (11:36 +1000)]
fstests: convert top level files and tools to SPDX
Scripted conversion, see script in initial SPDX license commit
message. Many files required touch-ups after the script had run
because of the old and widely different formats. most touchups were
to remove excess empty comment lines the script left behind.
Dave Chinner [Sat, 9 Jun 2018 01:34:49 +0000 (11:34 +1000)]
common: convert to SPDX license tags
These have been scripted conversions then cleaned up by hand as
there was no consistency to the formatting of the license headers in
the common/ directory. Author information was also removed (it's in
the git history) and so now the header format is consistently:
##/bin/bash
# SPDX-License-Identifier: GPL-2.0(+)
# Copyright (c) <date> <owner>. All Rights Reserved.
#
# <file description>
Dave Chinner [Sat, 9 Jun 2018 01:29:45 +0000 (11:29 +1000)]
fstests: Add LICENSES directory
In preparation for changing tests over to use SPDX tags, add the
initial licenses needed for the common/ and tests/ changeover to
the LICENSES/ directory. For this initial patch set, only the GPLv2
license text is required.
The tests and other common scripts will be converted to tags via a
script and, if necessary touched up to fix any warts the script
can't handle. The script is run on a target via:
for f in `git grep -l "GNU General" <target>` ; do
echo $f
cat $f | awk -f hdr.awk > $f.new
mv -f $f.new $f
done
This, unfortunately, changes the permissions of the files, so each
patch was post processed to remove the mode change fields from
the patches before they were committed. This preserves the file
modes, even though the files were replaced.
The awk script that dos all the substitution work is as follows:
/^#[\-]{65}/ {
if (hdr == 1 && ignore == 0) {
ignore = 1
hdr = 0
} else if (ignore == 1) {
# use this to ignore empty comment line after license
ignore = 2
}
next
}
/This program is free software/ {
if (hdr == 1 && ignore == 0) {
ignore = 1
hdr = 0
}
next
}
/02110-1301[, ] *USA/ {
# use this to ignore empty comment line after license
if (ignore = 1) {
ignore = 2
}
next
}
/^#[ ]*Copyright/ {
if (cstr != "")
cstr = cstr "\n"
cstr = cstr $0
next
}