Currently many tests and other functions uses it's own way to get block
size of the file system. Introduce get_block_size(), a generic way to
get block size of mounted file system and use that instead.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This test is motivated by a bug found in btrfs when replaying a
directory from the fsync log. The issue was that if a directory
entry is both found in the persisted metadata and in the fsync
log, at log replay time the directory got set with a wrong i_size.
This had the consequence of not being able to rmdir empty
directories (failed with errno ENOTEMPTY).
This was fixed in btrfs with the following linux kernel patch:
Btrfs: fix directory recovery from fsync log
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
XFS allocates extra indirect blocks for delayed allocation extents at
write time. When delalloc extents are split, the existing indirect block
reservation was historically divided up evenly among the new extents
even though the overall requirement for two extents could exceed the
requirement for the original. Repeated delalloc extent splits ultimately
leads to extents with 0 indirect blocks and in turn leads to assert
failures in XFS.
Add a test to stress indirect block reservation for delayed allocation
extents. The test converts a single delalloc extent to many and operates
on the remaining extents to detect or trigger potential problems.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
XFS had a data corruption problem where writeback of pages to unwritten
extents would fail to run unwritten extent conversion at I/O completion.
This causes subsequent reads of written, but unconverted regions to
return zeroes. This occurs on sub-page block size filesystems when
writeback contends for the inode lock (e.g., with a file writer).
Add a test that creates the conditions to reproduce the data corruption
and detect it by looking for unwritten extents after all said extents
have been overwritten.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
It does not seem to be necessary and is not supported by busybox
tar.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Only the executable name is required and this allows busybox
killall to be used.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Change all occurrences of stat --format and stat --printf to stat -c
so that the tests work correctly on BusyBox systems.
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This test exposed a problem with XFS where it failed to write back a
partial page correctly during a fcollapse operation. This left a
stray dirty buffer on the page, and hence invalidation of the page
then failed of the fcollapse returned an EBUSY error.
Make this a generic test so that we can ensure that all filesystems
handle the case correctly. Test case originally worked out and
written by Brian Foster.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This test exposed a problem with mapped writes to the tail page of a
file in XFS and potentially ext4. Eric did all the hard work of
taking the bug report and generating the reproducable test case on
ext4. Make it a generic test so that we can ensure that all
filesystems handle the case correctly.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This test exposed a problem with mapped writes to the tail page of a
file in XFS. Hence make it a generic test so taht we can ensure that
all fielsystems handle the case correctly.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
I'm getting enospc errors on a 4GB test device after a while of
running. Part of the issue is that many tests can't or don't clean
up previous failed runs when they start or if the run to success.
Hence while we want to slowly age the test filesystem, we don't
really want that aging to unintentionally run the filesystem out of
space. To that end:
$ sudo du -s /mnt/test/* | sort -nr |head -10
1929160 /mnt/test/fsfile
512000 /mnt/test/247.8133
512000 /mnt/test/247.4713
512000 /mnt/test/247.4488
466752 /mnt/test/fstest.9850.2
40000 /mnt/test/resv
29804 /mnt/test/fsstress.12144.1
26208 /mnt/test/populate_root
26208 /mnt/test/mnt
23216 /mnt/test/fsstress.4491.1
We can see that there are a few tests that using most of the space.
These are often left behind due to kernel failures during tests or
reboots while tests are in progress, so make sure that they at least
clean up such mess the next time they run.
Test generic/247, xfs/020 (fsfile) and generic/074 (fstest.$$.n)
are the worst offenders, so just target these to being with.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This test is motivated by a btrfs issue where a ranged fsync would
prevent a subsequent fsync from persisting any extents that were
dirty at the time of the first fsync but that were outside the range
of that first fsync (which should have been persisted by the second
fsync).
This bug in btrfs is fixed by the following linux kernel patch:
Btrfs: fix fsync data loss after a ranged fsync
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
CIFS/SMB protocol without POSIX extensions doesn't support operations
with symbolic links and advisory byte-range locks from the same process.
Add checks these features and use them in generic tests that require
such operations.
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
The existing code calls remount for $TEST_DEV with constantly defined
mount options. This can fail if a user specifies different mount options.
Fix this by using new _test_remount() call that remounts $TEST_DEV.
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Some tests deliberately corrupt scratch devices and so will fail
the post-test check. Add a "_require_scratch_nocheck" helper
function for such tests to avoid false test failure detection.
Also, ensure that _notrun cleans up the trigger for the post-test
checks. Otherwise the next test to run may try to validate the
scratch/test devices even though they are not used by the test.
Further, _check_xfs_filesystem() causes check to exit if it finds a
corruption. This is extremely annoying as it terminates the entire
test run rather than just reporting that the test fails. Hence add
an "iam != check" test before exiting so that calls from tests will
cause the test to fail, but calls from check won't cause the harness
to exit.
There are still some tests that fail the scratch check, these are
not obvious test failures and so need further investigation to
determine the cause of the failures.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Add _require_xfs_io_command "fiemap" to test 225 to properly handle the
situation when fiemap isn't supported by the filesystem.
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
We need a source of "filler" that can fill up a 50M file system.
Unfortunately, on some systems /lib/modules might not exist at all.
In that case, use /usr instead.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Check defrag utility on file with large number of fragments, from 20 to 2000.
2000 fragments means that b+tree will have at least two index blocks.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Sometimes it is not easy to know number of expected extents in advance.
In that case it is reasonable to provide sane MIN and MAX values.
Also helper will check that number of extents before defragmentaion
is not greather than after.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Currently we're checking file system consistency on TEST_DEV after every
successful test run even though the TEST_DEV might not even be used in
that test.
Fix it by introducing _require_test to for the test ti indicate that
it's about to use TEST_DEV.
Also add _require_test to the new script so that this requirement is a
default.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
There are about 198 tests which requires scratch_dev, but does not check
the file system consistency afterwards. Xfstests infrastructure does not
do it automatically, so fix it by running _check_scratch_fs() after
each test that _require_scratch.
Also remove all the _check_scratch_fs() calls that are not actually needed
and will be covered by the check script.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
By closing the file descriptor before calling io_destroy, you pretty
much guarantee that the last put on the ioctx will be done in interrupt
context (during I/O completion). This behavior has unearthed bugs in
the kernel in several different kernel versions, so let's add a test to
poke at it.
The original test case was provided by Matt Cross. He has graciously
relicensed it under the GPL v2 or later so that it can be included in
xfstests. I've modified the test a bit so that it would generate a
stable output format and to run for a fixed amount of time.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
generic/317 and generic/318 fail un-gracefully on older kernels
which don't support userns; fix that by running a simple test
as a prerequisite and fail gracefully if needed.
Roll that in with the test for executable presence, and make
a new _require_userns()
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
The following kernel commit introduced a race condition that causes
getcwd(2) to return "/" instead of correct path
232d2d6 dcache: Translating dentry into pathname without taking rename_lock
Jan Stancek hit it once when building ltp and Mikulas Patocka could
hit it by running lvm2 test suite. Please refer to this thread
https://www.mail-archive.com/ltp-list@lists.sourceforge.net/msg17896.html
These commits fixed the bug
ede4ceb prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts
f650080 __dentry_path() fixes
Cc: Artem Savkov <asavkov@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Run 8 processes writing 1k files to seperate files in seperate dirs to
hit ENOSPC on small fs with little free space. Loop for 100 iterations.
Regression test for
34cf865 ext4: fix deadlock when writing in ENOSPC conditions
Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>