This test exercises xfs_db functionality that relates to the free space
btrees on the data device. Therefore, make sure that the files we
create are not realtime files.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This is yet another one of those tests that looks at what happens when
we run out of space for more metadata (in this case, xattrs). Make sure
that the 256M we write to the file to try to stimulate ENOSPC gets
written to the same place that xfs puts xattr data -- the data device.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
A previous update to this test dropped the clause where the mkfs
standard output gets sent to /dev/null. The filtered mkfs output isn't
needed here and it breaks the test, so fix that.
Fixes: e97f96e5 ("xfs/27[26]: force realtime on or off as needed")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Test case 631 fails for filesystems like exfat or vfat or any other
which does not support extended attributes.
The main reason for failure is not being able to mount overlayfs
with filesystems that do not support extended attributes.
mount -t overlay overlay -o "$l,$u,$w,$i" $mergedir
Above command would return an error as -
/var/mnt/scratch/merged0: wrong fs type, bad option, bad superblock
on overlay, missing codepage or helper program, or other error.
dmesg log reports the following -
overlayfs: filesystem on '/var/mnt/scratch/upperdir1' not supported
As per the overlayfs documentation -
"A wide range of filesystems supported by Linux can be the lower
filesystem, but not all filesystems that are mountable by Linux
have the features needed for OverlayFS to work. The lower filesystem
does not need to be writable. The lower filesystem can even be another
overlayfs. The upper filesystem will normally be writable and if it
is it must support the creation of trusted.* and/or user.* extended
attributes, and must provide valid d_type in readdir responses,
so NFS is not suitable. A read-only overlay of two read-only
filesystems may use any filesystem type."
As per the above statements from the overlayfs documentation,
it is clear that filesystems that do not support extended
attributes or d_type would not work with overlayfs.
This is why we see the error in dmesg log for upperdir1
which had an exfat filesystem.
This test case already checks for d_type but does not check for
extended attributes, hence add a check for it which would avoid
running this tests for filesystems that are not supported.
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Make sure that we can reset the root directory and the xattrs are erased
properly.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Since we're adding to xfs_repair the ability to warn about bad finobt
levels, filter that out.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
DAX doesn't support swapfile. Without this patch,
_require_scratch_swapfile always returns fail for fsdax. Now
change to notrun.
Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
Signed-off-by: Xiaoli Feng <xifeng@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
In commit 725feeff, I forgot that xfs has *not* always supported all
swap file configurations -- the bmap swapfile activation prior to the
introduction of iomap_swapfile_activate did not permit the use of
unwritten extents in the swap file. Therefore, kick xfs out of the
always-supported list.
Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Since the advent of iomap_swapfile_activate in XFS, we actually /do/
support having swap files on the realtime device. Remove this test.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Add a test for commit 18bb8bbf13c1 ("btrfs: zoned: automatically
reclaim zones").
This test creates a two file on a newly created FS in a way that
when we delete the first one, an auto reclaim process will be
triggered by the FS.
After the reclaim process, it verifies that the data was moved to
another zone and old zone was successfully reset.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Introduce some zone related helper functions: _zone_type(),
_require_zoned_device(), and _require_non_zoned_device(). They all
take a device path as an argument.
_zone_type() return the zone type of the device according to the
value returned from "/sys/block/<disk>/queue/zoned". See
Documentation/ABI/testing/sysfs-block for a detail.
_require_zoned_device() checks if the device is zoned. If not, it
skips the current test. _require_non_zoned_device() does the
opposite.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
When this case runs on system without mount_setattr syscall support, it
will report errors rather than skip. so we add _require_idmapped_mounts
to check if mount_setattr syscall is supported.
Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Test for fsync data loss after renaming a file or adding a hard link,
with a previous fsync of another file, as well as that mtime and ctime
are correct after a power failure. Test both with COW and NOCOW writes.
This currently fails differently on different kernels:
- For kernels older than 4.19 (<= 4.18) and kernels starting from 5.10,
the NOCOW tests are expected to fail very often on the mtime and ctime
checks.
The data loss check has slim chances of failing on a virtualized
environment, because the race that leads to the data loss is due to
the fsync() returning after writeback of the data finishes and
returning without issuing barriers (sending REQ_PREFLUSH to the
device), as explained in the test's comments.
For kernels between 4.19 (inclusive) and 5.9 (inclusive), it is not
expected to fail.
- For the btrfs integration branch (misc-next), and what is currently in
Linus' master branch (5.13 merge window changes), in addition to the
failures mentioned before, the test should fail very often on the data
loss and mtime/ctime checks for COW writes.
The issues are fixed by a patch for the kernel that has the following
subject:
"btrfs: fix race leading to unpersisted data and metadata on fsync"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
exFAT's access time has 2s granularity and is rounded down.
This can cause problems, e.g.:
if real access times are: time1=2 and time2=7, then 7 - 2 = 5;
but exfat_atime(7) - exfat_atime(2) => 6 - 2 = 4 which is less
than expected delay.
To fix this, even (delay - 1s) should be considered as a valid result
for exFAT.
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Tmpfs doesn't support metadata journalling. Recognize it as such.
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Kernel commit 708fa01597fa ("ovl: allow upperdir inside lowerdir")
changes the rules w.r.t allowed overlayfs configurations, so the
upperdir/lowerdir test that expects an error fails.
Adapt the test to check the configuration that is still not allowed
(lowerdir inside upperdir), which had no test coverage.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
On ext2/ext3, it's expected that several single block metadata reads
can occur when writing to file in the same cgroup (the stack is like
below[1]). The purpose of the "write -> read/write" subtest is to
make sure the larger pwrite is accounted to the correct cgroup, not
necessarily enforce that zero bytes are read in service of the
write. This patch fixes the sub-test in order to tolerate small
reads in 1st cgroup.
[1] Callchain of the read:
@ext3_read_bio[
submit_bio+1
submit_bh_wbc+365
ext4_read_bh+72
ext4_get_branch+201
ext4_ind_map_blocks+382
ext4_map_blocks+295
_ext4_get_block+170
__block_write_begin_int+328
ext4_write_begin+541
generic_perform_write+213
ext4_buffered_write_iter+167
new_sync_write+345
vfs_write+438
__x64_sys_pwrite64+140
do_syscall_64+51
entry_SYSCALL_64_after_hwframe+68
, 5793, 12]: 3
Signed-off-by: Boyang Xue <bxue@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
The nfs_export feature was introduced since kernel v4.16-rc1 after
commit f168f1098dd9038 ("ovl: add support for "nfs_export"
configuration"). On old kernel, this case will result in infinite
loop because overlay mount failed because of unrecognized mount
options nfs_export=off.
In kernel documentation, overlay.rst said "the mount options
index=off,nfs_export=on are conflicting for a read-write mount and
will result in an error.". So using single index=off is also ok in
here.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
When compile xfstest on old kernel, mount-idmapped.c will fail
because of missing linux/bpf.h. But this src file doesn't use bpf
realted functions or macros.
So remove these useless header files in idmapped-mounts.c and
mount-idmapped.c.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
We don't add fallback for renameat2, so it build failed on old
kernel. Also, renameat2() man-pages said as below:
"renameat2() has an additional flags argument. A renameat2() call
with a zero flags argument is equivalent to renameat()."
In this src file, we use zero flag for all renameat2 call. So we use
renameat directly.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Reviewed-by:Anju T Sudhakar<anju@linux.vnet.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
When compile them old gcc, get the following error
mount-idmapped.c: In function 'parse_map':
mount-idmapped.c:154:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0; i < 2; i++) {
Fix them by declaring them at the beggining instead of in loop.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Since xfstests commit 56908a2eb566c5("common/quota: move _qsetup()
helper to common code"), we have common _qsetup function. Even this
case doesn't use enforce value like xfs/050 and xfs/299, using
_qsetup is more meaningful. So remove useless qsetup.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Many test cases use xfs_io -c 'falloc' but forgot to add
_require_xfs_io_command "falloc". This will fail the test case if we
run the test case on a file system without fallcoate support e.g.
F2FS.
While we believe that normal fallocate(mode = 0) is always supported
on Linux, it is not true. Fallocate is disabled in several
implementations of zoned block support for file systems because the
pre-allocated region will break the sequential writing rule.
Currently, several test cases unconditionally call fallocate().
Let's add _require_xfs_io_command "falloc" to properly check the
feature is supported by a testing file system.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>