Darrick J. Wong [Thu, 1 Nov 2018 23:19:09 +0000 (16:19 -0700)]
quota: clean out speculative preallocations when checking quota usage
On XFS, the only reliable way to clean out speculative post-eof
preallocations, delayed allocations, and speculative cow preallocations
is to cycle the filesystem mount. Since we're comparing the post-test
quota counts against a freshly quotacheck to look for leaks, it's fine
to cycle the mount. This eliminates sporadic quota count failures when
running xfstests with quotas enabled.
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 [Tue, 30 Oct 2018 18:03:28 +0000 (11:03 -0700)]
populate: create leafn dir when populating xfs filesystem
We've had some problems lately with directories containing a single
leafn directory. It turns out that the populate script doesn't create
these, so teach it to do so.
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 [Mon, 29 Oct 2018 18:12:42 +0000 (11:12 -0700)]
xfs: test packaged crc32c code
Use the new crc32selftest command in xfs_io to check the correct
operation of the packaged xfsprogs, on the off chance that the packages
were cross compiled on a different machine type (which means the build
time test doesn't hold much water).
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 [Fri, 2 Nov 2018 01:09:48 +0000 (12:09 +1100)]
check: use full paths for diff on error
i don't run fstests from the source directory, so when I get a
golden image mismatch the relative path to the golden output is
not useful:
(Run 'diff -u tests/generic/013.out /home/dave/src/xfstests-dev/results//xfs_64k/generic/013.out.bad' to see the entire diff)
Change the output to emit the real path for the golden out so this
can be cut and pasted and run from anywhere.
(Run 'diff -u /home/dave/src/xfstests-dev/tests/generic/013.out /home/dave/src/xfstests-dev/results//xfs_64k/generic/013.out.bad' to see the entire diff)
Filipe Manana [Mon, 29 Oct 2018 09:43:40 +0000 (09:43 +0000)]
fstests: fix fssum to actually ignore file holes when supposed to
Unless the '-s' option is passed to fssum, it should not detect file holes
and have their existence influence the computed checksum for a file. This
tool was added to test btrfs' send/receive feature, so that it checks for
any metadata and data differences between the original filesystem and the
filesystem that receives send streams.
For a long time the test btrfs/007, which tests btrfs' send/receive with
fsstress, fails sporadically reporting data differences between files.
However the md5sum/sha1sum from the reported files in the original and
new filesystems are the same. The reason why fssum fails is because even
in normal mode it still accounts for number of holes that exist in the
file and their respective lengths. This is done using the SEEK_DATA mode
of lseek. The btrfs send feature does not preserve holes nor prealloc
extents (not supported by the current protocol), so whenever a hole or
prealloc (unwritten) extent is detected in the source filesystem, it
issues a write command full of zeroes, which will translate to a regular
(written) extent in the destination filesystem. This is why fssum reports
a different checksum. A prealloc extent also counts as hole when using
lseek.
For example when passing a seed of 1540592967 to fsstress in btrfs/007,
the test fails, as file p0/d0/f7 has a prealloc extent in the original
filesystem (in the incr snapshot).
Fix this by making fssum just read the hole file and feed its data to the
digest calculation function when option '-s' is not given. If we ever get
btrfs' send/receive to support holes and fallocate, we can just change
the test and pass the '-s' option to all fssum calls.
Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Filipe Manana [Sat, 27 Oct 2018 08:48:58 +0000 (09:48 +0100)]
fstests: add some tests to the 'log' group that use dmflakey
Some tests that use dmflakey to test filesystem consistency after a power
failure are in the 'log' group while others are not. So fix the
incosistency and put them all under the 'log' group.
Filipe Manana [Sat, 27 Oct 2018 08:48:38 +0000 (09:48 +0100)]
btrfs: fix classification of a couple btrfs tests
Test btrfs/108 does not test collapse, in fact btrfs does not even support
the fallocate collapse operation, so remove it.
Test btrfs/159 does not test collapse either, it tests hole punching, so
replace the collapse group with the punch group.
Chao Yu [Sat, 27 Oct 2018 01:55:20 +0000 (09:55 +0800)]
generic/508: fix to check inode creation time feature on scratch mountpoint
_require_btime() just check inode creation time feature on TEST_DIR
mountpoint, but generic/508 needs to do that check on SCRATCH_MNT
mountpoint. Let's add _require_scratch_btime() for that, meanwhile
handling scratch_{mkfs,mount,umount} inside the function to decouple
with caller.
Darrick J. Wong [Tue, 16 Oct 2018 03:29:13 +0000 (20:29 -0700)]
generic: test reflink side effects
Test that ctime gets updated and suid is cleared when we reflink.
Ensure we can't reflink about RLIMIT_FSIZE. Ensure that we can't
expose stale preallocation block data when reflinking above EOF.
Make sure dedupe actually catches a single different byte.
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>
Filipe Manana [Mon, 15 Oct 2018 09:22:46 +0000 (10:22 +0100)]
btrfs: fix test btrfs/007 to not leave temporary files in /tmp
This test was using the "mktemp -d" command to create a temporary
directory for storing send streams and computations from fssum,
without ever deleting them when it finishes. Therefore after running
it for many times it filled up all space from /tmp.
Fix this by using a temporary directory in TEST_DEV instead, as all
the more recent send/receive tests do, to store these files, and
making sure they get deleted when the test finishes. On average the
sum of the size of those files is between 5.5Mb to 6Mb, but changing
the number of operations for fsstress makes it even bigger.
Filipe Manana [Mon, 15 Oct 2018 08:51:17 +0000 (09:51 +0100)]
generic: test fsync after fallocate on a very small file
Test that if we have a very small file, with a size smaller than the
block size, then fallocate a very small range within the block size
but past the file's current size, fsync the file and then power
fail, after mounting the filesystem all the file data is there and
the file size is correct.
This test is motivated by a failure in btrfs where it triggered an
assertion when using the no-holes feature, that is, when running
with MKFS_OPTIONS="-O no-holes". The btrfs issue is fixed by a patch
for the linux kernel titled:
"Btrfs: fix assertion on fsync of regular file when using no-holes
feature"
Commit 7a7641063ac3a7ae051c9e1959f4d7b1a25bb91c (xfs/140: work with 64k
block size) created a test filesystem with AG size set to (8192 * block
size). When working with a 1k block sized XFS filesystem, this tries to
set the AG size to 8MiB which is less than the minimum AG size of
16MiB. Hence creation of the filesystem had actually failed.
This commit fixes the issue by resetting AG size to 16MiB if (8192 *
block size) results in a value less than 16MiB. Later the test file size
and the test file block count are then appropriately calculated.
Commit 0e2b99951fa11ea8a8adf4676aef130cfeeb5250 (xfs/139: work with 64k
block size) created a test filesystem with AG size set to (8192 * block
size). When working with a 1k block sized XFS filesystem, this tries to
set the AG size to 8MiB which is less than the minimum AG size of
16MiB. Hence creation of the filesystem had actually failed.
This commit fixes the issue by setting AG size to be (16384 * block
size).
Amir Goldstein [Thu, 11 Oct 2018 14:41:06 +0000 (17:41 +0300)]
src/fiemap-tester: fix getting blocksize on overlayfs
There was a regression in v4.19-rc1 that caused FIGETBSZ ioctl
to return 0 on an overlayfs file.
That regression went unnoticed because the xfstests that run
fiemap-tester program terminated in success status after not doing
much instead of failing.
Check for invalid value of block size returned by FIGETBSZ ioctl,
so these tests can detect the regression.
Fallback to statfs(2) for getting the filesystem blocksize if
FIGETBSZ ioctl fails (i.e. on overlayfs).
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>
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>
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>
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).
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"
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.
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)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>