xfstests-dev.git
13 years agoxfstests: make 127 and 134 clean up after themselves
Alex Elder [Fri, 4 Mar 2011 20:22:10 +0000 (20:22 +0000)]
xfstests: make 127 and 134 clean up after themselves

Tests 127 and 134 leave temp files around when they complete.
Fix (or enable) their cleanup functions to remedy this.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: change directory to / before _cleanup_testdir in test 135
Boris Ranto [Tue, 8 Mar 2011 13:29:20 +0000 (13:29 +0000)]
xfstests: change directory to / before _cleanup_testdir in test 135

Nfs tries to umount $testdir in _cleanup_testdir function. Tests 126
and 135 call the function from directory $SCRATCH_MNT that is equal
to $testdir (at least for nfs). The umount will therefore fail,
causing the test to fail due to the output mismatch.

Test 126 also does double a umount thanks to the call to _cleanup
before exit and the trap command.  So remove the unnecessary call of
the _cleanup function before exit.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoAdd fallocate calls to fsx
Eric Sandeen [Wed, 9 Mar 2011 16:35:19 +0000 (10:35 -0600)]
Add fallocate calls to fsx

Add random runtime fallocate calls to fsx (vs. the existing
preallocate file at start of run).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years ago225: Run with different random seeds
Eric Sandeen [Wed, 9 Mar 2011 16:30:07 +0000 (10:30 -0600)]
225: Run with different random seeds

Running the fiemap-tester with a unique random seed each time
may uncover some things missed by always using the default.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years ago225: add additional fiemap-tester run without sync
Eric Sandeen [Tue, 8 Mar 2011 15:16:23 +0000 (09:16 -0600)]
225: add additional fiemap-tester run without sync

Chris Mason pointed out that some filesystems were not doing
the right thing on fiemap, in the face of delalloc extents.

Because test 225 ran with FIEMAP_FLAG_SYNC only, this didn't
get caught.  Add a runtime option, and run it both ways.

Note that this changes defaults for fiemap-tester, so that
it no longer calls with FIEMAP_FLAG_SYNC by default, and
a new option -S is added to do so.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoFix fiemap-tester for fewer extents returned
Eric Sandeen [Tue, 8 Mar 2011 15:09:38 +0000 (09:09 -0600)]
Fix fiemap-tester for fewer extents returned

If the fiemap call returns fewer extents than asked for,
the fiemap tester gets confused.  If this happens, advance,
and call fiemap again for the next offset.

XFS exposed this because if a file is all-delalloc, it was
only returning 1 mapped extent (this is probably also a buglet).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoNotify via syslog when godown is shutting down fs
Eric Sandeen [Wed, 23 Feb 2011 16:35:07 +0000 (10:35 -0600)]
Notify via syslog when godown is shutting down fs

Just a hint for those perusing logs that the ensuing shutdown is
intentional...

Feb 16 17:06:17 hostname godown: xfstests-induced forced shutdown of /mnt/scratch
Feb 16 17:06:17 hostname kernel: Filesystem "sdb3": xfs_log_force: error 5 returned.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoAdd test 251: Check filesystem FITRIM implementation
Lukas Czerner [Wed, 9 Feb 2011 16:36:17 +0000 (16:36 +0000)]
Add test 251: Check filesystem FITRIM implementation

FITRIM ioctl  is used on a mounted filesystem to discard (or "trim")
blocks which are not in use by the filesystem.  This is useful for
solid-state drives (SSDs) and thinly-provi-sioned storage. This test
helps to verify filesystem FITRIM implementation to assure that it
does not corrupts data.

This test creates checksums of all files in xfstests directory and
run several processes which clear its working directory on SCRATCH_MNT,
then copy everything from xfstests into its working directory, create
list of files in working directory and its checksums and compare it with the
original list of checksums. Every process works in the loop so it repeat
remove->copy->check, while fstrim tool is running simultaneously.

Fstrim is just a helper tool which uses FITRIM ioctl to actually do the
filesystem discard.

I found this very useful because when the FITRIM is really buggy (thus
data-destroying) the 251 test will notice, because checksums will most
likely change.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years ago164: write a multiple of 4k instead of 512
Jeff Moyer [Mon, 14 Feb 2011 16:58:00 +0000 (11:58 -0500)]
164: write a multiple of 4k instead of 512

When running test 164 against a 4k sector device, the initial file write
of 50K fails with EINVAL, since it isn't a multiple of the device sector
size.  I fixed this by bumping the amount written to 52K.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years ago091: fix up output when pagesize == sectorsize
Jeff Moyer [Mon, 14 Feb 2011 16:44:25 +0000 (11:44 -0500)]
091: fix up output when pagesize == sectorsize

It looks like test 091 is supposed to work on 2.4 kernels, but there's
no way it will.  Checking the actual blocksize and pagesize in the
run_fsx routine, and substituting them for BSIZE and PSIZE is error
prone when the two hold the same value.  This is also a problem for 4k
sector devices.  It's better to pass in what we want (PSIZE or BSIZE)
and then convert that to the command line options that fsx wants in the
run_fsx routine.  This gets rid of the bogus test failure in my
environment.  Also, the setting of bsize for linux-2.6 was redundant, so
I got rid of it.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years ago089: fix error caused by weird stdout buffer handling
Lukas Czerner [Wed, 2 Feb 2011 15:52:59 +0000 (16:52 +0100)]
089: fix error caused by weird stdout buffer handling

We have hit the error while running 089.

FSTYP         -- ext3
PLATFORM      -- Linux/x86_64 localhost 2.6.32-109.el6.x86_64

...
...
 completed 50 iterations
 completed 50 iterations
 completed 50 iterations
-completed 50 iterations
 completed 10000 iterations
 directory entries:
 t_mtab
Ran: 089
Failures: 089
Failed 1 of 1 tests

This is not very easily reproducible, however one can hit it
eventually when running 089 in the loop. The problem is apparently, that
the output might get lost, probably due to some stdio buffer weirdness.

This commit workaround the issue by adding an optional argument to the
t_mtab to specify output file. The t_mtab output is then appended to a
file which content is then printed to the stdout as it would if no
output file is used.

With this commit applied the problem is no longer reproducible.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: conditionalise allocsize option in 014
Dave Chinner [Mon, 14 Feb 2011 00:23:29 +0000 (11:23 +1100)]
xfstests: conditionalise allocsize option in 014

allocsize is an XFS specific mount option, and hence causes the test
to fail on other filesystems. Only set the mount option on xfs
filesystems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
13 years agoxfstests: Speed up test 042
Dave Chinner [Mon, 14 Feb 2011 00:22:07 +0000 (11:22 +1100)]
xfstests: Speed up test 042

test 042 generates a worst-case fragmented filesystem and uses it to
test xfs_fsr. It uses small 4k files to generate the hole-space-hole
pattern that fragments free space badly. It is much faster to
generate the same pattern by creating a single large file and
punching holes in it.  Also, instead of writing large files to
create unfragmented space, just use preallocation so we don't have
to write the data to disk.

These changes reduce the runtime of the test on a single SATA drive
from 106s to 27s.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: make 016 work with delaylog
Dave Chinner [Mon, 14 Feb 2011 00:21:44 +0000 (11:21 +1100)]
xfstests: make 016 work with delaylog

Test 016 fails with delaylog because it measures log traffic to disk
and delaylog writes almost nothing to the log for the given test. TO
make it work, add sync calls to the work loop to cause the log to be
flushed reliably for both delaylog and nodelaylog and hence contain
the same number of log records.

As a result, the log space consumed by the test is not changed by
the delaylog option and the test passes. The test is not
significantly slowed down by the addition of the sync calls (takes
15s to run on a single SATA drive).

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: add test to reproduce bmap btree corruption.
Dave Chinner [Mon, 14 Feb 2011 00:20:00 +0000 (11:20 +1100)]
xfstests: add test to reproduce bmap btree corruption.

The problem was reprted here:

https://bugzilla.redhat.com/show_bug.cgi?id=626244

With the simple test case:

# mkfs.xfs -f -d agsize=16m,size=50g <dev>
# mount <dev> /mnt
# xfs_io -f -c 'resvsp 0 40G' /mnt/foo

Triggering the problem. Turn this into a new xfsqa test so that we
exercise the problem code and prevent future regressions.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: add simple splice test
Dave Chinner [Mon, 10 Jan 2011 23:31:33 +0000 (10:31 +1100)]
xfstests: add simple splice test

We don't have any coverage of the splice functionality provided by
the kernel in xfstests. Add a simple test that uses the sendfile
operation built into xfs_io to copy a file ensure we at least
execute the code path in xfstests.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
13 years ago078: xfs_repair should be run against the losetup'd device, not the image file
Jeff Moyer [Fri, 11 Feb 2011 22:04:37 +0000 (17:04 -0500)]
078: xfs_repair should be run against the losetup'd device, not the image file

When running test 078 against a 4k logical block sized disk, it fails in
xfs_repair.  The problem is that xfs_repair is passed the loopback
filename instead of the actual loop device.  This means that it opens
the file O_DIRECT, and tries to do 512 byte aligned I/O to a 4k sector
device.  The loop device, for better or for worse, will do buffered I/O,
and thus does not suffer from the same problem.  So, the attached patch
sets up the loop device and passes that to xfs_repair.  This resolves
the issue on my test system.

Comments are more than welcome.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years ago240: only run when the file system block size is larger than the disk sector size
Jeff Moyer [Fri, 11 Feb 2011 20:20:02 +0000 (15:20 -0500)]
240: only run when the file system block size is larger than the disk sector size

This test really wants to test partial file-system block I/Os.  Thus, if
the device has a 4K sector size, and the file system has a 4K block
size, there's really no point in running the test.  In the attached
patch, I check that the fs block size is larger than the device's
logical block size, which should cover a 4k device block size with a 16k
fs block size.

I verified that the patched test does not run on my 4k sector device
with a 4k file system.  I also verified that it continues to run on a
512 byte logical sector device with a 4k file system block size.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoaiodio_sparse2: fix up alignment for 4k logical block sized devices
Jeff Moyer [Fri, 11 Feb 2011 19:08:09 +0000 (14:08 -0500)]
aiodio_sparse2: fix up alignment for 4k logical block sized devices

When running xfstests on a 4k logical sector device, I ran into a test
failure in test 198.  The errors were all due to trying to do 512 byte
aligned I/O on a 4k logical sector device.  The attached patch tries to
auto-detect the proper block size if no alignment is specified.  If it
fails for one reason or another, it defaults to 4k alignment.  This
seems to work fine in my test rig.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years ago243: remove test files before starting
Eric Sandeen [Tue, 11 Jan 2011 15:38:15 +0000 (15:38 +0000)]
243: remove test files before starting

I found that overwriting existing files hides a bug
in ext4 (since fixed).  Removing the files before
the test reliably reproduces it.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests 241: run longer
Eric Sandeen [Thu, 6 Jan 2011 17:44:25 +0000 (17:44 +0000)]
xfstests 241: run longer

I ran into a failure on an ext4 backport which should have
been caught by this test, but 30s wasn't long enough to
hit it reliably.  So run a bit longer; it's not in the
quick group anyway.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: 014 takes forever with large preallocation sizes
Dave Chinner [Fri, 7 Jan 2011 12:58:50 +0000 (23:58 +1100)]
xfstests: 014 takes forever with large preallocation sizes

Christoph reported that test 014 went from 7s to 870s runtime with
the dynamic speculative delayed allocation changes. Analysis of test
014 shows that it does this loop 10,000 times:

pwrite(random offset, 512 bytes);
truncate(random offset);

Where the random offset is anywhere in a 256MB file. Hence on
average every second write or truncate extends the file.

If large preallocatione beyond EOF sizes are used each extending
write or truncate will zero large numbers of blocks - tens of
megabytes at a time. The result is that instead of only writing
~10,000 blocks, we write hundreds to thousands of megabytes of zeros
to the file and that is where the difference in runtime is coming
from.

The IO pattern that this test is using does not reflect a common (or
sane!) real-world application IO pattern, so it is really just
exercising the allocation and truncation paths in XFS. To do this,
we don't need large amounts of preallocation beyond EOF that just
slows down the operation, so execute the test with a fixed, small
preallocation size that reflects the previous default.

By specifying the preallocation size via the allocsize mount option,
this also overrides any custom allocsize option provided for the
test, so the test will not revert to extremely long runtimes when
allocsize is provided on the command line.

However, to ensure that we do actually get some coverage of the
zeroing paths, set the allocsize mount option to 64k - this
exercises the EOF zeroing paths, but does not affect the runtime of
the test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfsqa: make hole tests independent of speculative allocation patterns
Dave Chinner [Fri, 7 Jan 2011 12:59:15 +0000 (23:59 +1100)]
xfsqa: make hole tests independent of speculative allocation patterns

Many of the "count-the-holes" tests (008, 012, etc) do writes that extend the
file and hence allocation patterns are dependent on speculative allocation
beyond EOF behaviour. Hence if we change that behaviour, these tests all fail
because there is a different pattern of holes.

Make the tests independent of EOF preallocation behaviour by first truncating
the file to the size the test is defined to use. This prevents speculative
prealocation from occurring, and hence changes in such behaviour will not cause
the tests to fail.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: ensure uint64_t is defined for <linux/fs.h>
Alex Elder [Mon, 29 Nov 2010 22:14:00 +0000 (22:14 +0000)]
xfstests: ensure uint64_t is defined for <linux/fs.h>

When compiling "fiemap-tester.c" in my environment, I am
getting complaints at the first reference to "uint64_t"
in <linux/fs.h>.  This simple patch resolves that.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: pwrite hang when writing from mmaped buffer of the same page
Zhong, Xin [Thu, 16 Dec 2010 10:09:39 +0000 (11:09 +0100)]
xfstests: pwrite hang when writing from mmaped buffer of the same page

The problem is found in meego testing on btrfs:
http://bugs.meego.com/show_bug.cgi?id=6672

Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
Reviewed-by: Hellwig, Christoph <hch@infradead.org>
Reviewed-by: Chinner, Dave <david@fromorbit.com>
13 years agoxfstests: filter spaces in xfs_quota output in test case 108
Boris Ranto [Wed, 15 Dec 2010 19:10:57 +0000 (20:10 +0100)]
xfstests: filter spaces in xfs_quota output in test case 108

xfs_quota can output different amounts of spaces when it is trying to align
its output. This can cause output mismatch on several systems in test case 108.

Filter all the consecutive spaces in xfs_quota output to just one space,
making the test case independent of the alignment.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: ignore absolute address in filename in test case 237
Boris Ranto [Tue, 14 Dec 2010 19:17:16 +0000 (20:17 +0100)]
xfstests: ignore absolute address in filename in test case 237

Test case 237 checks for setfacl output. The setfacl can use both
relative address or absolute address for filename.

Following patch ignores the unnecessary part of absolute address and
therefore the test case can pass on systems that output absolute
address.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: getfacl -n unsupported in older acl package
Boris Ranto [Wed, 1 Dec 2010 14:14:56 +0000 (15:14 +0100)]
xfstests: getfacl -n unsupported in older acl package

Test cases 051 and 067 use getfacl with option -n. This works well on newer systems but older acl package know only its longer version: --numeric.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: add _scratch_mkfs_sized support for btrfs
Josef Bacik [Tue, 30 Nov 2010 22:22:36 +0000 (23:22 +0100)]
xfstests: add _scratch_mkfs_sized support for btrfs

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstest 245: accept ENOTEMPTY as a valid error
Josef Bacik [Tue, 30 Nov 2010 22:22:34 +0000 (23:22 +0100)]
xfstest 245: accept ENOTEMPTY as a valid error

Test 245 only checks to see if the rename returned EEXIST, but according to the
rename(2) manpage, ENOTEMPTY is also a valid result, which is in fact what Btrfs
returns.  So just filter the output for ENOTEMPTY so that either EEXIST or
ENOTEMPTY will pass the test.  It's not pretty I know, but I couldn't really
figure out a good way to get an either/or output to compare.  With this fix
Btrfs now passes 245.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 247: Test for race between direct I/O and mmap
Lachlan McIlroy [Fri, 19 Nov 2010 16:17:34 +0000 (10:17 -0600)]
xfstests 247: Test for race between direct I/O and mmap

A customer reported a problem:

If a process is using mmap to write to a file on an
ext4 filesystem while another process is using direct
I/O to write to the same file the first thread may
receive a SIGBUS during a page fault.

A SIGBUS occurs if the page fault tries to access a
page that is entirely beyond the end of the file but
in this test case that should not be happening.

Signed-off-by: Lachlan McIlroy <lmcilory@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: check block truncation after write failure
Christoph Hellwig [Fri, 19 Nov 2010 14:57:05 +0000 (15:57 +0100)]
xfstests: check block truncation after write failure

Extraced from  https://bugzilla.kernel.org/show_bug.cgi?id=22452
"data corruption after mmap()ing a file and writev() some data to another file"

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests 223: reinitialize MKFS_OPTIONS
Boris Ranto [Thu, 18 Nov 2010 02:44:57 +0000 (20:44 -0600)]
xfstests 223: reinitialize MKFS_OPTIONS

Test case 223 constantly fails because the variable carrying mkfs
options is not being reinitialized.

Test calls function _scratch_mkfs_geom repeatedly in for loop without
cleaning the MKFS_OPTIONS variable. Since _scratch_mkfs_geom only
appends options to the variable, MKFS_OPTIONS looks like this in 5th
iteration:
MKFS_OPTIONS="-bsize=4096-b size=4096 -d su=8192,sw=4-b size=4096 -d
su=16384,sw=4-b size=4096 -d su=32768,sw=4-b size=4096 -d
su=65536,sw=4-b size=4096 -d su=131072,sw=4"

It is also easy to see that _scratch_mkfs_geom does not append leading
space when it appends the variable.

Following patch fixes the issue for me and based on my testing does not
break any other test case:

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
13 years agoxfstests: add test for renaming over non-empty directories
Christoph Hellwig [Tue, 9 Nov 2010 13:53:39 +0000 (14:53 +0100)]
xfstests: add test for renaming over non-empty directories

Per Posix renames over non-empty directories should fail, but hfsplus used to
allow this (and corrupt the filesystem while doing so).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: add _require_sparse_files
Christoph Hellwig [Tue, 9 Nov 2010 13:53:36 +0000 (14:53 +0100)]
xfstests: add _require_sparse_files

Add a helper to check if the filesystem supports sparse files.  This is
used to guard tests that exercise sparse file functionality and would
take forever on filesystems that have to zero all blocks on extending
truncates.

Unfortunately there's no good way to autodetect this functionality, so
just implement it as a blacklist for now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: do not call attr/getfattr/setfattr direcly
Christoph Hellwig [Thu, 21 Oct 2010 20:07:31 +0000 (20:07 +0000)]
xfstests: do not call attr/getfattr/setfattr direcly

always use the full path set up in common.attr.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: remove dead code in test 062
Christoph Hellwig [Thu, 21 Oct 2010 20:07:12 +0000 (20:07 +0000)]
xfstests: remove dead code in test 062

The _linux_attr_calls function is never called, remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: use a common _filter_test_dir function
Alex Elder [Fri, 22 Oct 2010 14:09:24 +0000 (14:09 +0000)]
xfstests: use a common _filter_test_dir function

Christoph Hellwig suggested that a function similar to the common
"_filter_scratch" function ought to be created to handle filtering
of the TEST_DIR and TEST_DEV variables.  This patch implements that.

The name "_filter_test" seems like it might suggest it does
something different, so I'm calling this one "_filter_test_dir".
This unfortunately makes the "test" and "scratch" functions have
different naming conventions, but I guess we should be accustomed to
that by now (consider "TEST_DIR" and "SCRATCH_MNT").

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: use a common _filter_scratch function
Alex Elder [Thu, 21 Oct 2010 19:00:08 +0000 (19:00 +0000)]
xfstests: use a common _filter_scratch function

There are a number of tests that use a shell function called
"filter_scratch" or "_filter_scratch" in order to have the actual
scratch device or mount point show up in test output with a symbolic
name.  There are two sets, each following a slightly different
convention.  Put a common _filter_scratch function definition in
"common.filter" and have all test scripts use that instead.
Choosing one of the two conventions meant that a few test output
files had to be changed.

In addition, add a call to _filter_scratch to test 185, and update
its output accordingly.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: handle filesystems without FIEMAP support
Christoph Hellwig [Thu, 21 Oct 2010 19:12:04 +0000 (21:12 +0200)]
xfstests: handle filesystems without FIEMAP support

Do a _notrun in 225 if we get EOPNOSUPP back from FIEMAP instead
of failing the test.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: add _require_attrs
Christoph Hellwig [Thu, 21 Oct 2010 19:11:48 +0000 (21:11 +0200)]
xfstests: add _require_attrs

Add a new helper to check if extended attributes are supported.  It
errors out if any of the attr tools are not found, or if a filesystem
does not support setting attributes.

Remove the opencoded checks for the attr tools from various tests
now that we do them in common code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: fix quota detection
Christoph Hellwig [Thu, 21 Oct 2010 03:55:58 +0000 (05:55 +0200)]
xfstests: fix quota detection

Even if the kernel has quota support built in most filesystems still
don't support it.  As there's no good way to find out if a filesystem
supports quotas hardcode the list of filesystems that do support
quotas.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: fix _require_acl
Christoph Hellwig [Thu, 21 Oct 2010 03:55:11 +0000 (05:55 +0200)]
xfstests: fix _require_acl

Skip ACL tests if we get EOPNOTUPP back from the acl calls.  This is
the error code we get on a kernel that does support the xattr system
calls, but does not support the attributes used to handle Posix ACLs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: randholes: a few final cleanups
Alex Elder [Thu, 14 Oct 2010 14:51:01 +0000 (14:51 +0000)]
xfstests: randholes: a few final cleanups

Minor bits to wrap up this series.
- Bumped up the number of blocks read at once from 10 to 256
- Shorten remaining long lines
- Re-factor findblock()
- Get rid of global variable "nvalid"
- Add a few more comments
- Give all global symbols static scope
- Update the copyright message
- Various other minor formatting changes.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: encapsulate argument parsing
Alex Elder [Thu, 14 Oct 2010 14:50:57 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate argument parsing

Move the argument parsing code out of main() and into a separate
parseargs() routine.  The name of the target file for the test
is returned by parseargs() if no error occurs.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: clean up readblks()
Alex Elder [Thu, 14 Oct 2010 14:50:51 +0000 (14:50 +0000)]
xfstests: randholes: clean up readblks()

Make readblks() a bit more readable by computing a few things
into local variables, and pulling out a few of the comma-separated
expressions that were previously in the for loop headers.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: encapsulate realtime setup code
Alex Elder [Thu, 14 Oct 2010 14:50:43 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate realtime setup code

Encapsulate the code that sets up the use of files on the realtime
volume.  Using realtime implies direct I/O; move the code that makes
that so into the argument parsing code.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: use posix_memalign()
Alex Elder [Thu, 14 Oct 2010 14:50:36 +0000 (14:50 +0000)]
xfstests: randholes: use posix_memalign()

Use posix_memalign() rather than memalign() regardless of whether
direct I/O is to be used.  Don't store the dioattr data in a global
variable.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: encapsulate direct I/O setup code
Alex Elder [Thu, 14 Oct 2010 14:50:27 +0000 (14:50 +0000)]
xfstests: randholes: encapsulate direct I/O setup code

Pull the code used to get alignment information for direct I/O into
a separate function.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: hide some Irix/Linux differences more tidily
Alex Elder [Thu, 14 Oct 2010 14:50:19 +0000 (14:50 +0000)]
xfstests: randholes: hide some Irix/Linux differences more tidily

Define a macro "xfscntl()" that effectively hides the differences
between the Linux xfsctl() and Irix fcntl() kernel interfaces.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: rearrange fns and drop their declarations
Alex Elder [Thu, 14 Oct 2010 14:50:08 +0000 (14:50 +0000)]
xfstests: randholes: rearrange fns and drop their declarations

Rearrange the functions in the file so they no longer need to be
declared at the top.  (This change involves only wholesale moves
of these blocks of code.)

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: document options a bit more
Alex Elder [Thu, 14 Oct 2010 14:50:00 +0000 (14:50 +0000)]
xfstests: randholes: document options a bit more

Reformat the usage message and provide a little more
information about default values and units for options
for the "randholes" command.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: only allocate write buffer when needed
Alex Elder [Thu, 14 Oct 2010 14:49:52 +0000 (14:49 +0000)]
xfstests: randholes: only allocate write buffer when needed

If nothing is being written (i.e., in "test" mode), there's no need
for "randholes" to allocate a write buffer.  But to do this we make
this series of changes:
- When "very" verbose (> 1), there's no point in printing the values
  that have just been written to the file.  They are just the file
  offset, and the buffer will not have changed between initializing
  those values and writing it out.
- If we don't print the values at those offsets, then there's no
  need to fill them in at all when we're in test mode.
- Now we only use the write buffer if we're not in test mode,
  so we can skip the allocation.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: randholes: Fix two bugs
Alex Elder [Thu, 14 Oct 2010 14:49:43 +0000 (14:49 +0000)]
xfstests: randholes: Fix two bugs

This patch fixes two bugs in the "randholes" test program.

First, it is possible for findblock() to return -1 if the random
block number it picks is at or above the highest in-range block
that's already been selected.  But this case isn't checked and
the value is blindly used thereafter as if it were valid.  Just
exit if this ever occurs.

Second, when the "alloconly" option is is set, blocks are
preallocated in the target file rather than actually writing them.
But unlike when the blocks are written and subsequently read, the
preallocated blocks are *not* offset by the fileoffset parameter.

I'm pretty sure nobody every noticed this because the program itself
doesn't do any verification when blocks are only preallocated.  But
it's an inconsistency and I think it ought to be fixed.

Signed-off-by: Alex Elder <aelder@sgi.com>
Acked-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: Fix some file permission.
Alain Renaud [Thu, 7 Oct 2010 22:22:55 +0000 (17:22 -0500)]
xfstests: Fix some file permission.

I notice that some of the test script do not have execute
permission. To be consistent I changed the permissions to be 755.
Can someone verify that this is valid.

Thanks.

Signed-off-by: Alain Renaud <arenaud@sgi.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoDon't depend on mkfs.xfs output in some tests
Arkadiusz Miśkiewicz [Sat, 2 Oct 2010 07:45:19 +0000 (07:45 +0000)]
Don't depend on mkfs.xfs output in some tests

Tests 136 and 206 rely on mkfs.xfs output.

136 test was currently broken with hardcoded mkfs.xfs output (that
contained for example meta-data=/dev/sda8). Drop that part from
output.

Ignore projid32bit output existence for test 206.

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: make 223 use more compatible indirection operator
Alain Renaud [Fri, 1 Oct 2010 13:09:33 +0000 (13:09 +0000)]
xfstests: make 223 use more compatible indirection operator

Hello all,

I notice while running xfstests on SLES machine that the test 223 fail
because of syntax error.

# bash 223
QA output created by 223
223: line 66: syntax error near unexpected token `>'
223: line 66: `    _scratch_mkfs_geom $SUNIT_BYTES 4 $BLOCKSIZE&>>  $seq.full'

The error is due to the use of the '&>>' operator for redirection
that does not work  on older bash version(3.2.x).  Note that this
operator only seem to work with bash version 4.X+

This patch simply replace the operator with '>>  $seq.full 2>&1'
which does the same thing.

Signed-off-by: Alain Renaud <arenaud@sgi.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: test 244 to test quota project id setting overflow
Arkadiusz Mi?kiewicz [Sun, 26 Sep 2010 06:10:56 +0000 (06:10 +0000)]
xfstests: test 244 to test quota project id setting overflow

Test 3 quota project setting id conditions:
- set 16bit project quota id -> should succeed
- set 32bit project quota id -> should succeed (with projid32bit
  patch applied; fail otherwise)
- over 32bit project quota id -> should always fail

Updated by <aelder@sgi.com>:
- Shortened some long lines, including failure output

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: fix 108 and enable it by default
Christoph Hellwig [Fri, 1 Oct 2010 04:04:33 +0000 (06:04 +0200)]
xfstests: fix 108 and enable it by default

Apply the prjquota check to the scratch device so that it doesn't fail,
and add the test to the auto and quick groups now that it works.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: Use $MKFS_OPTIONS in _scratch_mkfs_*()
Lukas Czerner [Wed, 29 Sep 2010 16:23:04 +0000 (11:23 -0500)]
xfstests: Use $MKFS_OPTIONS in _scratch_mkfs_*()

Pass MKFS_OPTIONS to mkfs.$FSTYP in _scratch_mkfs_sized().
Preserve user defined MKFS_OPTIONS in _scratch_mkfs_geom().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redaht.com>
13 years agoxfstests 224: Use $SCRATCH_MNT variable
Lukas Czerner [Wed, 29 Sep 2010 16:21:21 +0000 (11:21 -0500)]
xfstests 224: Use $SCRATCH_MNT variable

Use $SCRATCH_MNT variable instead of hard-coded path (/mnt/scratch) in
test 224.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
13 years agoFix project quota checks
Arkadiusz Miśkiewicz [Thu, 9 Sep 2010 17:47:35 +0000 (19:47 +0200)]
Fix project quota checks

Project quota check in few tests should check SCRATCH_DEV and not
TEST_DEV. Fix that by making possible to pass device to be checked to
_require_prjquota().

Due to the problem tests didn't run with "Installed kernel does not
support project quotas" error.

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoDon't hardcode paths to many binaries.
Arkadiusz Miśkiewicz [Thu, 9 Sep 2010 17:02:17 +0000 (19:02 +0200)]
Don't hardcode paths to many binaries.

Stop hardcoding paths to getfattr, setfattr, attr, quota, xfs_quota,
killall, indent and xfs_copy binaries.

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
- new
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 243: Test to ensure that the EOFBLOCK_FL gets set/unset correctly.
Akshay Lal [Wed, 8 Sep 2010 18:51:33 +0000 (13:51 -0500)]
xfstests 243: Test to ensure that the EOFBLOCK_FL gets set/unset correctly.

As found by Theodore Ts'o:
If a 128K file is falloc'ed using the KEEP_SIZE flag, and then
write exactly 128K, the EOFBLOCK_FL doesn't get cleared correctly.
This is bad since it forces e2fsck to complain about that inode.
If you have a large number of inodes that are written with fallocate
using KEEP_SIZE, and then fill them up to their expected size,
e2fsck will potentially complain about a _huge_ number of inodes.
This would also cause a huge increase in the time taken by e2fsck
to complete its check.

Test scenarios covered:
1. Fallocating X bytes and writing Y (Y<X) (buffered and direct io)
2. Fallocating X bytes and writing Y (Y=X) (buffered and direct io)
3. Fallocating X bytes and writing Y (Y>X) (buffered and direct io)

These test cases exercise the normal and edge case conditions using
falloc (and KEEP_SIZE).

Ref: http://thread.gmane.org/gmane.comp.file-systems.ext4/20682

Signed-off-by: Akshay Lal <alal@google.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
13 years agoxfstests: update README file to document some recent changes
Alex Elder [Mon, 2 Aug 2010 17:51:00 +0000 (17:51 +0000)]
xfstests: update README file to document some recent changes

Update the README file to document the new _cat_passwd and
_cat_group functions, and to recommend passing "-n" to
getfacl(1) so it produces numeric output.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 241: Add missing golden output
Eric Sandeen [Mon, 30 Aug 2010 20:14:19 +0000 (15:14 -0500)]
xfstests 241: Add missing golden output

Dave reminded me of this in his review and then I forgot to
add it.  :(  But I'm taking his comment of it missing as a review
of this fix....

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: Show duration of current test
Lukas Czerner [Thu, 8 Jul 2010 15:23:52 +0000 (15:23 +0000)]
xfstests: Show duration of current test

It may be useful to compare both times, last and current, in the
xfstests output.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
13 years agoxfstests: add a test for XFS_IOC_ZERO_RANGE
Dave Chinner [Mon, 23 Aug 2010 13:10:40 +0000 (23:10 +1000)]
xfstests: add a test for XFS_IOC_ZERO_RANGE

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 228: suppress core dump message
Eric Sandeen [Fri, 20 Aug 2010 19:27:07 +0000 (14:27 -0500)]
xfstests 228: suppress core dump message

When running 228 with abrt on in rhel6, I was getting different
output due to a (core dumped) message on SIGXFSZ.  For some reason
I wasn't able to use sed to filter it, and just ulimit -c 0 didn't
suppress it either.

abrt sets the core pattern to:

"|/usr/libexec/abrt-hook-ccpp /var/spool/abrt %p %s %u %c""

which apparently allows core dumps even if ulimit -c is 0, due
to the pipe.

Temporarily changing the kernel's core pattern to just plain "core"
and setting ulimit -c to 0 does suppress it.  These are reset to
original values after the test is run.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 241: run parallel dbench
Eric Sandeen [Fri, 20 Aug 2010 19:15:50 +0000 (14:15 -0500)]
xfstests 241: run parallel dbench

ext4 was corrupting inode table bitmaps due to a mishmash of
atomic & nonatomic bitops.  This got broken twice and fixed
twice; let's add a test.

On a 4-way box this reliably ends up with a corrupted filesystem
if we get it wrong (upstream as of 2.6.35 at least is fine again)

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Dave Chinner <david@fromorbit.com>
13 years agoxfstests: fix NIS detection damage
Dave Chinner [Fri, 13 Aug 2010 05:45:24 +0000 (15:45 +1000)]
xfstests: fix NIS detection damage

NIS detection wasn't tested on machines without NIS enabled, so many tests are
failing on non-NIS machines. the _yp_active function has no specific return
value so always evaluates as 0 (active) and the "_cat_passwd" function is
called from within an awk script which is not valid as the shell may run with a
sanitised environment. Hence the functions do not need specific export calls,
either, as unsanitised subshells will automatically inherit the parent's
environment.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: fix depend targets
Alex Elder [Fri, 30 Jul 2010 21:49:48 +0000 (21:49 +0000)]
xfstests: fix depend targets

There's no need to re-make the dependency files all the time.  Make
it so the "depend" target rebuilds the ".dep" file only if necessary.
Also change the name of the dependency file created for "ltdepend"
to be ".ltdep".

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfstests: have getfacl(1) report numeric id's
Alex Elder [Fri, 30 Jul 2010 21:54:23 +0000 (21:54 +0000)]
xfstests: have getfacl(1) report numeric id's

This patch arranges for calls to getfacl(1) to be given the "-n"
flag, which requests that user and group id's be listed numerically
rather than using names.  The affected test output files are also
updated to indicate the effect of the change.

This eliminates some spurious output differences I was seeing, due
to the presence of NIS in my test environment.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: include NIS databases
Alex Elder [Fri, 30 Jul 2010 21:52:39 +0000 (21:52 +0000)]
xfstests: include NIS databases

If NIS is active on a test target system, additional password and
group file information is available via their respective databases
in NIS.  Currently, some tests assume that /etc/passwd and /etc/group
are the only places to find this information.

This patch causes both the local database and the NIS database (if
one is likely to be present) to be consulted for needed information.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 240: test non-aligned AIO hole-filling
Eric Sandeen [Fri, 23 Jul 2010 16:18:59 +0000 (11:18 -0500)]
xfstests 240: test non-aligned AIO hole-filling

This replicates file corruption we've seen with qemu-kvm when
we use if=virtio,cache=none,aio=native for IO to a sparse
ext4- or xfs-hosted file, and the partitions/filesystems
within that file image are not block-aligned.  (think sector
63 here...)  This results in AIO IOs not aligned to the
filesystem blocks.

This test modifies aiodio_sparse2.c to add an option to start
the file IO at an offset.

When we do 4k writes to a 16k file in 2 threads, starting
at offset 512, we get 0s interspersed in the file where they
should not be:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  01 01 01 01 01 01 01 01  01 01 01 01 01 01 01 01  |................|
*
00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001200  01 01 01 01 01 01 01 01  01 01 01 01 01 01 01 01  |................|
....

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoAdd test for correct $SCRATCH_MNT into _require_scratch
Jan Kara [Wed, 21 Jul 2010 16:50:52 +0000 (18:50 +0200)]
Add test for correct $SCRATCH_MNT into _require_scratch

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoProvide generic function for checking quota usage
Jan Kara [Wed, 21 Jul 2010 16:50:51 +0000 (18:50 +0200)]
Provide generic function for checking quota usage

Provide generic function _check_quota_usage for checking whether quota usage
matches the space used and use it in proper tests.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: test the aio unwrittent extent conversion race
Christoph Hellwig [Wed, 14 Jul 2010 02:38:58 +0000 (04:38 +0200)]
xfstests: test the aio unwrittent extent conversion race

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 years agoxfsqa: test 214 leaves files around that cause 236 to fail
Dave Chinner [Thu, 24 Jun 2010 22:25:56 +0000 (08:25 +1000)]
xfsqa: test 214 leaves files around that cause 236 to fail

Test 214 and 236 use the same file names for test files in the TEST
filesystem and don't check/create clean initial test state. Hence if
you run 214 then 236, 236 will fail with:

+link: cannot create link `/mnt/test/ouch2' to `/mnt/test/ouch': File exists
+ctime: 1277076527 -> 1277076527
+Fatal error: ctime not updated after link

Ensure that both tests clean up after themselves properly and also
ensure a clean state before they start.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfsqa: test open_by_handle() on unlinked and freed inode clusters
Dave Chinner [Thu, 24 Jun 2010 22:26:25 +0000 (08:26 +1000)]
xfsqa: test open_by_handle() on unlinked and freed inode clusters

When Christoph and I were discussing bulkstat coherency on IRC, we
realised that inode lookup from bulkstat was not actually looking up
the inode allocation btree in xfs_imap() before reading the inode
buffer from disk in xfs_iread(). Bulkstat uses the same lookup
mechanism as handle validation to avoid shutting down the filesystem
if inode numbers that point to non-inode buffers (i.e. invalid) are
passed in the handle.

The problem with this is that when we delete inodes from disk and we
remove the inode chunk (i.e. deallocate inodes) we mark both the
inodes in memory and the cluster buffer as stale, thereby preventing
it from being written back to disk. The result of this is that some
number of inodes remain on disk looking like allocated, in use
inodes (i.e.  di_mode is not zero).

Hence if we get a cold cache lookup from a stale handle that
references such an inode, we can read the inode off disk even though
it has been deleted because we don't check if the inode is allocated
or not.  If the inode chunk has not been overwritten, then the inode
read will succeed and the handle-to-dentry conversion will not error
out like it is supposed to. The result is that stale NFS filehandles
and open_by_handle() will succeed incorrectly on unlinked files for
cold cache lookups.

This is a bug that has been present ever since the inode chunk
deletion code was implemented. This test exercises the problem and
documents the hoops you have to jump through to reproduce it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: add check for setfacl by non-owner
Shi Weihua [Thu, 27 May 2010 19:16:43 +0000 (21:16 +0200)]
xfstests: add check for setfacl by non-owner

Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: check for ctime updates on link(2)
Shi Weihua [Thu, 27 May 2010 19:16:29 +0000 (21:16 +0200)]
xfstests: check for ctime updates on link(2)

Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoMerge branch 'quota-tests' of git://git.kernel.org/pub/scm/linux/kernel/git/jack...
Christoph Hellwig [Thu, 27 May 2010 15:56:37 +0000 (17:56 +0200)]
Merge branch 'quota-tests' of git://git./linux/kernel/git/jack/xfstests-dev/

13 years agoMake test 229 XFS specific
Jan Kara [Tue, 25 May 2010 16:25:53 +0000 (18:25 +0200)]
Make test 229 XFS specific

Only XFS supports directory 'extsize' feature.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoAdd test for quota accounting after remount read only
Jan Kara [Mon, 24 May 2010 10:04:56 +0000 (12:04 +0200)]
Add test for quota accounting after remount read only

Check that quota accounting works after remounting read-only and
then back read-write.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoAdd test of quota limit and info setting
Jan Kara [Wed, 19 May 2010 13:12:01 +0000 (15:12 +0200)]
Add test of quota limit and info setting

Add test stressing addition and removal of quota structures and setting
of quota grace time.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoAdd quota accounting test when fsstress is run and quota limits are set low
Jan Kara [Wed, 19 May 2010 11:00:36 +0000 (13:00 +0200)]
Add quota accounting test when fsstress is run and quota limits are set low

Test various error recovery paths whether they properly handle EDQUOT failures.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoAdd quota test with fsstress
Jan Kara [Tue, 18 May 2010 23:22:13 +0000 (01:22 +0200)]
Add quota test with fsstress

Run fsstress and verify that quota accounting is correct after it finishes.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoAdd test of quota accounting using fsx
Jan Kara [Tue, 18 May 2010 23:00:21 +0000 (01:00 +0200)]
Add test of quota accounting using fsx

Run fsx (and also several fsx threads in parallel) and verify that
quota accounting is correct after they finish.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoTest basic quota enforcement
Jan Kara [Tue, 18 May 2010 21:26:57 +0000 (23:26 +0200)]
Test basic quota enforcement

Add a test which checks whether basic quota enforcement works.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoxfstests: 226: have xfs_io use bigger buffers
Alex Elder [Wed, 19 May 2010 22:44:14 +0000 (22:44 +0000)]
xfstests: 226: have xfs_io use bigger buffers

By default xfs_io uses a buffer size of 4096 bytes.  On test 226,
the result is that the test runs much slower (at least an order
of magnitude) than it needs to.

Add a flag to the "pwrite" command sent to xfs_io so it uses
larger buffers, thereby speeding things up considerably.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoFix fallocate() test
Jan Kara [Mon, 24 May 2010 09:46:44 +0000 (11:46 +0200)]
Fix fallocate() test

The test for fallocate was broken because it used $TEST_DIR/$tmp.io. Because
$tmp is usually something like /tmp/1234 or /mnt/1234 the file cannot be
created and xfs_io fails regardless of existance of fallocate support. Moreover
the subsequent message parsing decides that fallocate is actually supported
because it does not expect this message.

Fix the test to not use $tmp.

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoFix test whether kernel supports quotas
Jan Kara [Wed, 19 May 2010 09:25:52 +0000 (11:25 +0200)]
Fix test whether kernel supports quotas

For all 2.6 kernels presence of quota support in kernel can be detected by
checking /proc/sys/fs/quota. This is actually more reliable than trying to
mount a filesystem with quota options (for example because SCRATCH_DEV does
not have to contain a filesystem type we are going to test).

Signed-off-by: Jan Kara <jack@suse.cz>
13 years agoxfstests: test extent size hints
Christoph Hellwig [Mon, 10 May 2010 17:39:04 +0000 (19:39 +0200)]
xfstests: test extent size hints

This is an adapted version of the reproduced in OSS BZ #874, which
shows file corruption when using the extent size hint.

Signed-off-by: Geoffrey Wehrman <gwehrman@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests: honor comments in the test group file
Alex Elder [Thu, 6 May 2010 17:26:07 +0000 (17:26 +0000)]
xfstests: honor comments in the test group file

There are some spots in the "group" file where test numbers have
groups listed after a '#' character, clearly intending for those
groups to be commented out.  But the way the group list gets
generated that commenting doesn't work, and in fact these tests
explicitly *are* included in such commented-out groups.

This patch fixes that, stripping out all comments (which start
with a '#' character and end with a newline) from the file before
building the set of test numbers for a group.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfstests 228: New testcase to check if fallocate respects RLIMIT_FSIZE
Amit Arora [Wed, 5 May 2010 19:15:08 +0000 (14:15 -0500)]
xfstests 228: New testcase to check if fallocate respects RLIMIT_FSIZE

Add a new testcase to the xfstests suite to check if fallocate respects
the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or
not, on a particular filesystem.

Signed-off-by: Amit Arora <aarora@in.ibm.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
13 years agoxfstests: Add query fiemap count test.
Tao Ma [Tue, 4 May 2010 06:01:00 +0000 (16:01 +1000)]
xfstests: Add query fiemap count test.

According to Documentation/filesystems/fiemap.txt, If fm_extent_count
is zero, then the fm_extents[] array is ignored (no extents will be
returned), and the fm_mapped_extents count will hold the number of
extents needed.

This is broken by commit 97db39a1f6f69e906e98118392400de5217aa33a.
So add this test case in fiemap tester to avoid future regression.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
13 years agoxfsqa: build dbtest on debian platforms
Dave Chinner [Tue, 4 May 2010 06:01:26 +0000 (16:01 +1000)]
xfsqa: build dbtest on debian platforms

Set up autoconf to find the correct headers and compat libraries for
debian squeeze, and massage the includes to ensure the right headers get
included. Also fix a compile warning that was emitted now that it is being
compiled.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfsqa: keep xfs_fsr output around in test 222
Dave Chinner [Tue, 4 May 2010 06:01:36 +0000 (16:01 +1000)]
xfsqa: keep xfs_fsr output around in test 222

To confirm that xfs_fsr is doing the right thing, make it output debug
and verbose messages and store them in the 222.full file so that it
can be checked after the fact for correct operation.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 years agoxfsqa: clean up 030 repair output
Dave Chinner [Tue, 4 May 2010 06:01:47 +0000 (16:01 +1000)]
xfsqa: clean up 030 repair output

With the new checks in xfs_repair, it outputs more information
about errors found than previously. This new output can be ignored
for the purposeѕ of this test, so filter it all out. This will
allow the test to run on new and old reapir binaries.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>