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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Since btrfs-dump-tree has been removed from btrfs-progs, use btrfs
inspect-internal dump-tree instead of btrfs-dump-tree.
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
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:
"mkfs.xfs -f -b size=4k -m rmapbt=1,reflink=1 $dev" will take 3075
4k blocks (12M) by default:
meta-data=/dev/mapper/xxxx-xfscratch isize=512 agcount=8, agsize=4096 blks
...
log =internal bsize=4096 blocks=3075, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
...
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>
Add btrfs test that checks "rmdir" or "rm -r" command can delete a
subvolume like an ordinary directory.
This behavior has been restricted long time but becomes allowed by
kernel commit a79a464d5675 ("btrfs: Allow rmdir(2) to delete an
empty subvolume")
The test will be skipped if kernel does not support the feature,
which can be checked whether /sys/fs/btrfs/features/rmdir_subvol
exists or not.
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
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:
"Btrfs: sync log after logging new name"
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
On filesystems that do not support O_DIRECT, the test should skip
itself with
generic/391 [not run] O_DIRECT is not supported
instead of failing with
generic/391 - output mismatch ...
...
+open: Invalid argument
Silence is golden
...
This patch make it do that by adding a call to _require_odirect.
Fixes https://github.com/rfjakob/gocryptfs/issues/244 .
Signed-off-by: Jakob Unterwurzacher <jakobunt@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>