xfstests-dev.git
5 years agofstests: move now-generic quota tests to generic
Eric Sandeen [Tue, 20 Sep 2016 22:24:59 +0000 (17:24 -0500)]
fstests: move now-generic quota tests to generic

Now that these tests have been made generic, move them into
the generic/ dir and update group files.

xfs/054 -> generic/379
xfs/118 -> generic/380
xfs/138 -> generic/381
xfs/260 -> generic/382

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: modify quota tests to work on generic filesystems
Eric Sandeen [Thu, 22 Sep 2016 18:54:16 +0000 (13:54 -0500)]
xfs: modify quota tests to work on generic filesystems

Fix several xfs quota tests to work on non-xfs filesystems.

New _require function to be sure that the xfs_quota tool can operate
on foreign filesystems; if it can, and if it needs to, it adds "-f"
to the XFS_QUOTA_PROG variable.

Modify _qmount to do quotacheck/quotaon to mount and /enable/
quota.  On xfs this isn't needed and/or fails; it's ignored.

All quota-related options used as arguments to _qmount are changed
from i.e. uquota to i.e. usrquota; the latter is standard across
almost all linux filesytems, including xfs.

xfs/260 filters out the root/default quota line, because ext4
consumes a different amount of space than xfs, and it's not what
we're testing for, so just ignore it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/260: fix output to match actions
Eric Sandeen [Tue, 20 Sep 2016 22:15:47 +0000 (17:15 -0500)]
xfs/260: fix output to match actions

The test creates 30 inodes, but says it created 300.
Just fix that up so the repquota output matches the
comments in the output file.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agofstests: require scratch dev in tests using dm targets
Eryu Guan [Thu, 22 Sep 2016 08:52:36 +0000 (16:52 +0800)]
fstests: require scratch dev in tests using dm targets

We build dm device on top of scratch dev so we require $SCRATCH_DEV
to be a valid block device in _require_dm_target(). And we need to
_require_scratch before _require_dm_target, otherwise test fails if
there's no SCRATCH_DEV defined, where it should _notrun.

  +Usage: _require_block_device <dev>

So add _require_scratch_nocheck to generic/347 (we do the fs check
on thinp device), move _require_scratch before _require_dm_target in
xfs/006 and xfs/264.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: fix fsmap check
Xiao Yang [Tue, 20 Sep 2016 05:23:12 +0000 (13:23 +0800)]
common/rc: fix fsmap check

We don't need -T to detect GETFSMAP and the flag doesn't exist
on really old versions of xfs_io, so just get rid of it.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: various operations on mounted fs
Zorro Lang [Wed, 14 Sep 2016 15:55:58 +0000 (23:55 +0800)]
xfs: various operations on mounted fs

xfsprogs takes use of ustat(2) to check if a given device is
mounted, but ustat(2) is deprecated and may not be available on
newer architectures, e.g. aarch64. In such cases, xfsprogs failed to
detect mounted device, which would result in something like
xfs_mdrestore overwriting a mounted XFS.

So adding a case to do xfs_mdrestore, xfs_copy, xfs_db, mkfs and
xfs_repair against mounted XFS to make sure they refuse to do so.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/098: fix xfs_repair on newer xfsprogs
Xiao Yang [Wed, 14 Sep 2016 02:52:36 +0000 (10:52 +0800)]
xfs/098: fix xfs_repair on newer xfsprogs

1) use _repair_scratch_fs instead of xfs_repair
   The obsolete xfs_repair always cleared the log regardless of
   whether it is corrupted and current xfs_repair only cleared the
   log when -L option is specified.  xfs_repair -L option should be
   used to clear it if xfs_repair failed to clear log.
2) catch non-zero return value instead of 2
   It can be applied to both the old return value 1 and the new
   return value 2
3) add filter_xfs_dmesg to ignore mount related warnings
   If we corrupt log and mount on a CONFIG_XFS_WARN build, there
   will be mount related warnings in dmesg as expected.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agooverlay: sgid inheritance over whiteout
Eryu Guan [Thu, 25 Aug 2016 08:16:12 +0000 (16:16 +0800)]
overlay: sgid inheritance over whiteout

Newly created files and dirs should inherit sgit bit from parent
dir, no matter the new files & dirs are created over whiteout or
not.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test getbmapx shared extent reporting
Darrick J. Wong [Thu, 25 Aug 2016 23:29:30 +0000 (16:29 -0700)]
xfs: test getbmapx shared extent reporting

Test that getbmapx returns exact shared extents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test getfsmap ioctl
Darrick J. Wong [Thu, 25 Aug 2016 23:29:24 +0000 (16:29 -0700)]
xfs: test getfsmap ioctl

Add some simple tests for the new getfsmap ioctl.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: simple permission check on hard links
Eryu Guan [Wed, 7 Sep 2016 09:57:15 +0000 (17:57 +0800)]
generic: simple permission check on hard links

Overlayfs had a bug that hardlinks don't share inode, if
chmod/chown/etc. is performed on one of the links then the inode
belonging to the other one won't be updated. The following patch
fixed this issue:

51f7e52 ovl: share inode for hard link

This is a simple test that has nothing overlayfs specific, so make
it a generic test.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: Enhance _exclude_scratch_mount_option to handle multiple options
Qu Wenruo [Thu, 8 Sep 2016 02:52:21 +0000 (10:52 +0800)]
common/rc: Enhance _exclude_scratch_mount_option to handle multiple options

Enhance _exclude_scratch_mount_option() function to normalize mount
options. Now it can understand and extract real mount option from
string like "-o opt1,opt2 -oopt3".

And now we do word grep to handle mount options like noinode_cache
and inode_cache.

Finally, allow it to accept multiple options at the same time. No
need for multiple _exclude_scratch_mount_option lines now

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/279: filter scsi debug device correctly
Eryu Guan [Mon, 5 Sep 2016 05:24:24 +0000 (13:24 +0800)]
xfs/279: filter scsi debug device correctly

This test assumes scsi debug device is "/dev/sd." when doing the
filter, but that isn't always true, I've seen failure like

  -mkfs with opts: DEVICE
  +mkfs with opts: DEVICEl

So use $SCSI_DEBUG_DEV to match the correct scsi debug device name.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agooverlay: copy-up lowerdir which has opaque xattr set
Eryu Guan [Mon, 8 Aug 2016 16:45:46 +0000 (00:45 +0800)]
overlay: copy-up lowerdir which has opaque xattr set

When copying up a directory with opaque xattr set, the xattr was
copied up as well, after a remount the opaque flag is honored so the
copied-up directory is treated as opaque, which causes files created
in the lowerdir to be hidden when using multiple lower directories.

This is fixed by "ovl: don't copy up opaqueness".

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: introduce _overlay_mount_dirs helper
Eryu Guan [Tue, 9 Aug 2016 07:28:47 +0000 (15:28 +0800)]
common/rc: introduce _overlay_mount_dirs helper

Introduce a new _overlay_mount_dirs() helper to do the actual
overlay mount operation and factor _overlay_scratch_mount and
_overlay_mount code to use a single implemention of
_overlay_mount_dirs(). Also convert all bare mount of overlay in
tests to use it.

Suggested-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoext4/021: use $XFS_IO_PROG instead of xfs_io
Xiao Yang [Mon, 5 Sep 2016 05:56:47 +0000 (13:56 +0800)]
ext4/021: use $XFS_IO_PROG instead of xfs_io

We should use $XFS_IO_PROG to add "-F" option when we need it.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: check the ag reservation counter ioctl
Darrick J. Wong [Thu, 25 Aug 2016 23:29:43 +0000 (16:29 -0700)]
xfs/122: check the ag reservation counter ioctl

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: track xfs_scrub_metadata
Darrick J. Wong [Thu, 25 Aug 2016 23:29:37 +0000 (16:29 -0700)]
xfs/122: track xfs_scrub_metadata

Make sure the metadata scrub ioctl structure doesn't change size.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test swapext with reflink
Darrick J. Wong [Thu, 25 Aug 2016 23:29:03 +0000 (16:29 -0700)]
xfs: test swapext with reflink

Add a few tests to stress the new swapext code for reflink and rmap.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: test btree header block sizes
Darrick J. Wong [Thu, 25 Aug 2016 23:28:51 +0000 (16:28 -0700)]
xfs/122: test btree header block sizes

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/159, 160: deal with EACCES -> EPERM transition
Darrick J. Wong [Thu, 25 Aug 2016 23:28:44 +0000 (16:28 -0700)]
generic/159, 160: deal with EACCES -> EPERM transition

As of 4.8 we can receive EPERM (instead of EACCES) for attempts to
reflink/dedupe to an immutable file.  Fix this up so that we accept
either answer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/130,235: deal with an unreplayable dirty log
Darrick J. Wong [Thu, 25 Aug 2016 23:28:38 +0000 (16:28 -0700)]
xfs/130,235: deal with an unreplayable dirty log

Now that we have log replay items, an FS shutdown due to a corrupt
btree results in a log that can't be replayed.  The only solution
here is to zap the log when we're fixing the corrupt fs, so do that
here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: decrease the log update done item sizes
Darrick J. Wong [Thu, 25 Aug 2016 23:28:32 +0000 (16:28 -0700)]
xfs/122: decrease the log update done item sizes

Redundant fields were removed from the rmap/refcount/bmap update
done log items, so fix the size tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agotests/xfs: don't run tests if cowextsize isn't present
Darrick J. Wong [Thu, 25 Aug 2016 23:28:25 +0000 (16:28 -0700)]
tests/xfs: don't run tests if cowextsize isn't present

Some of the tests forgot to check that xfs_io has a cowextsize
command, so fix that here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/172: raise fs size
Wang Xiaoguang [Wed, 31 Aug 2016 11:50:55 +0000 (19:50 +0800)]
generic/172: raise fs size

In original codes, if block size is 4096, fs size will be limited
to 60MB. In such small fs, btrfs is not able to write 40MB data,
because some space has been reserved internally, so the first
_pwrite_byte in this test case will fail for enospc error.

Also from this test case's test purpose, it tries to reflink a file
that uses more than half of the fs space, so here we can just define
fs size to be 256MB, the file to be reflinked to be 168MB.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: listxattr syscall with different buffer sizes
Artem Savkov [Tue, 30 Aug 2016 07:39:07 +0000 (09:39 +0200)]
generic: listxattr syscall with different buffer sizes

Add test that calls listxattr syscall with different buffer size
arguments checking if it fails properly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoREADME: fix up dependency lists
Eric Sandeen [Tue, 30 Aug 2016 19:12:27 +0000 (14:12 -0500)]
README: fix up dependency lists

2 things: Make the dependency lines cut-and-paste-able with
line continuations, and fix up the Fedora deps a bit
(remove "awk" - should be "gawk" - and add a couple other
missing dependencies)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: rw remount with unknown ro-compat features
Zorro Lang [Sun, 28 Aug 2016 12:50:25 +0000 (20:50 +0800)]
xfs: rw remount with unknown ro-compat features

Although ro-compat features cannot be mounted rw, a bug allows an
ro->rw remount transition, and this will corrupt the filesystem if
it contains ro-compat features unknown to the running kernel.

This bug has been fixed on linux kernel (d0a58e8 xfs: disallow rw
remount on fs with unknown ro-compat features), this case is the
regression testcase of that bug.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/095: add xfs_file_aio_read into warning whitelist
Zorro Lang [Fri, 26 Aug 2016 14:45:30 +0000 (22:45 +0800)]
generic/095: add xfs_file_aio_read into warning whitelist

Current generic/095 warning whitelist include:
"xfs_file_dio_aio_read" and "xfs_file_read_iter"

But from the history we can see:
1) xfs_file_dio_aio_read() was splited from xfs_file_read_iter() by
below commit:

  bbc5a74 xfs: split xfs_file_read_iter into buffered and direct I/O helpers

2) xfs_file_read_iter() came from xfs_file_aio_read() as below
commit:

  b4f5d2c xfs: switch to ->read_iter()

Some Linux distro (e.g: RHEL-7) still use the old kernel with old
function xfs_file_aio_read().

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agofstests: add punch, collapse, insert, zero test groups
Theodore Ts'o [Wed, 24 Aug 2016 21:01:28 +0000 (17:01 -0400)]
fstests: add punch, collapse, insert, zero test groups

Define test groups for those tests which have _require_xfs_io_command
for punch, collapse, insert, and zero.  This makes it easier to
exclude tests that use one of these fallocate commands.  Or if you
want to specifically test for those fallocate commands you can do
this.

This obviates an out-of-tree xfstests patch I maintain which used an
XFS_IO_AVOID environment variable to suppress running tests that use
punch, collapse, insert, etc.  This was rejected because of the
claim that it could be done using groups.  So this commit is in
response to those upstream comments.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: fsync after file rename
Filipe Manana [Tue, 23 Aug 2016 20:14:23 +0000 (21:14 +0100)]
generic: fsync after file rename

Test that if we rename a file, without changing its parent
directory, create a new file that has the old name of the file we
renamed, doing an fsync against the file we renamed works correctly
and after a power failure both files exists.

This is motivated by an issue found in btrfs, introduced in the
linux kernel 4.8-rc2, that caused lockdep to report a deadlock
scenario. The btrfs issue is fixed by the patch titled:

  "Btrfs: fix lockdep warning on deadlock against an inode's log mutex"

Tested against ext3/4, xfs, f2fs and reiserfs as well.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: Check clearing of SGID in chmod and acl_set_file
Andreas Gruenbacher [Tue, 23 Aug 2016 21:51:39 +0000 (23:51 +0200)]
generic: Check clearing of SGID in chmod and acl_set_file

Check if SGID is cleared upon chmod / setfacl when the owner is not
in the owning group.  As of today, the kernel fails to clear SGID in
setxattr (which is what acl_set_file is implemented on top of) in
that case; see this patch:

  https://patchwork.kernel.org/patch/9290507/

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: EIO error handling test
Zorro Lang [Fri, 19 Aug 2016 17:56:32 +0000 (01:56 +0800)]
xfs: EIO error handling test

Besides fail_at_unmount, all EIO error handling can stop umount
hanging on IO error too.

This case test EIO/max_retries and EIO/retry_timeout_seconds as
below:

1) fail_at_unmount=0 && \
   EIO/max_retries=1 && \
   EIO/retry_timeout_seconds=0

2) fail_at_unmount=0 && \
   EIO/max_retries=-1 && \
   EIO/retry_timeout_seconds=1

Make sure when fail_at_unmount=0, umount won't hang there.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/006: refactor reset error handling code to common/rc
Zorro Lang [Fri, 19 Aug 2016 17:56:31 +0000 (01:56 +0800)]
xfs/006: refactor reset error handling code to common/rc

Nearly 1/3 code is used to reset the xfs error handling attributes,
This part can be picked up, and used for other cases. So move them
to a new function _reset_xfs_sysfs_error_handling() in common/rc.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/033: source mkfs output again if isize less than 512
Zorro Lang [Sun, 21 Aug 2016 14:47:39 +0000 (22:47 +0800)]
xfs/033: source mkfs output again if isize less than 512

When blocksize is 512b, xfs/033 will run mkfs.xfs again to make sure
inode size is 512b. As below:

  # devzero blows away 512byte blocks, so make 512byte inodes (at least)
  _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
  . $tmp.mkfs
  [ $isize -lt 512 ] && \
          _scratch_mkfs_xfs -isize=512 | _filter_mkfs >/dev/null 2>&1

But after "566ebd5 mkfs: default to CRC enabled filesystems",
xfsprogs enable CRC as default. If MKFS_OPTIONS is "-b size=512 -m
crc=0", the first "_scratch_mkfs_xfs" will make crc=0, but the
second will change "crc" to "1", because it'll waive the "-b
size=512 -m crc=0" options.

xfs/033 need to check xfs's sb_features, to use different .out
files. So we should import the mkfs output($tmp.mkfs file) again, if
we mkfs again.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: improve _require_metadata_journaling() for ext4
Eric Whitney [Fri, 19 Aug 2016 16:47:38 +0000 (12:47 -0400)]
common/rc: improve _require_metadata_journaling() for ext4

The code in _require_metadata_journaling() currently rejects ext4
file systems that have been created without a journal.  However, an
ext4 file system with a journal should also be rejected if the
journal is not loaded and made available for use at mount time.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/135: redirect stderr from _scratch_mkfs
Eric Whitney [Thu, 18 Aug 2016 15:04:56 +0000 (11:04 -0400)]
generic/135: redirect stderr from _scratch_mkfs

In generic/135, benign warning message output from _scratch_mkfs on
stderr can cause a golden output mismatch, as can occur when testing
an ext4 bigalloc file system.  It's the only generic test that does
not also redirect stderr when directing _scratch_mkfs' stdout to
/dev/null.  Since error output from _scratch_mkfs doesn't seem
important to the overall intent of the test, there should be no harm
in making its stderr handling consistent.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/191: skip tests on older xfsprogs
Xiao Yang [Thu, 18 Aug 2016 03:09:16 +0000 (11:09 +0800)]
xfs/191: skip tests on older xfsprogs

If we don't have temp file used to test on xfsprogs 3.2.2,
_require_xfs_mkfs_validation will fail because mkfs.xfs can't create
this file. We need to skip tests before xfsprogs 4.7.0, so fix it.

This feature was introduced in xfsprogs 4.2.0 by commit 20cec860e16b
("mkfs.xfs: always use underlying fs sector size when mkfs'ing a
file")

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agosrc/test-nextquota: fix build failure with glibc 2.24
Omar Sandoval [Wed, 17 Aug 2016 00:18:28 +0000 (17:18 -0700)]
src/test-nextquota: fix build failure with glibc 2.24

glibc 2.24 defines Q_GETNEXTQUOTA but not `struct nextdqblk`. We
need to define it ourselves, but let's give it a hacky name that
won't cause another build error when the definition is added to
glibc.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test xfs_quota "state" command
Eric Sandeen [Tue, 16 Aug 2016 03:23:11 +0000 (22:23 -0500)]
xfs: test xfs_quota "state" command

This exercises the xfs_quota "state" command for every
combination of user, group, and project quota enablement
on both crc (with project quota inode on disk) and non-crc
(where project quota overlaps group quota on disk) filesystems.

It currently requires patches to the upstream kernel
("quota: fill in Q_XGETQSTAT inode information for inactive quotas")
and to xfsprogs ("xfs_quota: wire up XFS_GETQSTATV") to pass.

Rather than trying to make it run on older kernels without
crc capability, I restrict the test to crc-capable environments,
but test with and without crcs enabled (and hence with and without
project quota inode on disk).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/quota: add prjquota to _qmount_option() filter
Eric Sandeen [Fri, 12 Aug 2016 22:46:54 +0000 (17:46 -0500)]
common/quota: add prjquota to _qmount_option() filter

_qmount_option() did not properly filter the
"prjquota" mount option along with the "pquota"
variant, as it does for the other types.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agosrc/t_immutable: allow EPERM on immutable inode
Eryu Guan [Tue, 9 Aug 2016 08:04:16 +0000 (16:04 +0800)]
src/t_immutable: allow EPERM on immutable inode

Starting from kernel commit 337684a1746f ("fs: return EPERM on
immutable inode"), EPERM is returned instead of EACCES on immutable
inodes. So update src/t_immutable.c to accept EPERM as a PASS.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: add the realtime rmapbt inode and btree fields
Darrick J. Wong [Thu, 21 Jul 2016 23:48:00 +0000 (16:48 -0700)]
xfs/122: add the realtime rmapbt inode and btree fields

Add the on-disk structures added by the realtime rmapbt.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: scrub fs at the end of the test
Darrick J. Wong [Thu, 21 Jul 2016 23:47:51 +0000 (16:47 -0700)]
xfs: scrub fs at the end of the test

Teach _check_xfs_filesystem to scrub mounted filesystems before
unmounting and fscking them. This is mostly to test the online scrub
tool...

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoreflink: test cross-mountpoint reflink and dedupe
Darrick J. Wong [Thu, 21 Jul 2016 23:47:32 +0000 (16:47 -0700)]
reflink: test cross-mountpoint reflink and dedupe

Test sharing blocks via reflink and dedupe between two different
mountpoints of the same filesystem. This shouldn't work, since we
don't allow cross-mountpoint functions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoREADME: document Fedora, RHEL, and CentOS dependencies
Eric Sandeen [Fri, 5 Aug 2016 15:46:27 +0000 (10:46 -0500)]
README: document Fedora, RHEL, and CentOS dependencies

Document all build and runtime requirements for xfstests
on Fedora/RHEL/CentOS boxes, as was done earlier for Ubuntu.

Minor other README edits as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: test accurate shared extent reporting
Darrick J. Wong [Fri, 5 Aug 2016 07:38:54 +0000 (15:38 +0800)]
generic: test accurate shared extent reporting

Ensure that we can create a file with a single extent, reflink two
blocks out of the middle of that extent, and the resulting fiemap
reports two shared extents, instead of lazily reporting the entire
huge extent as shared.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoext4: Test expansion of inode size
Jan Kara [Thu, 4 Aug 2016 16:09:35 +0000 (18:09 +0200)]
ext4: Test expansion of inode size

ext4 supports dynamic expansion of inode size via inode's
i_extra_size field. Test the code performing the expansion in the
kernel.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/defrag: rework _require_defrag for ext4
Eric Whitney [Thu, 4 Aug 2016 20:02:46 +0000 (16:02 -0400)]
common/defrag: rework _require_defrag for ext4

The existing _require_defrag function rejects ext4 file systems
mounted with the dax option or constructed without extents.
However, there are also a number of other ext4 file system
configuration cases that do not currently support online defrag,
including encryption, data journaling, and bigalloc.  In the future,
online defrag functionality may be implemented for some of these,
and new configuration cases could be added that don't support it.

Rather than add a laundry list of mount and file system
configuration options to the existing _require_defrag function that
will need ongoing maintenance, use the available src/e4compact
program to directly determine whether the kernel supports ext4's
move extent ioctl on the test file system.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test attr_list_by_handle cursor iteration
Darrick J. Wong [Fri, 5 Aug 2016 02:03:51 +0000 (19:03 -0700)]
xfs: test attr_list_by_handle cursor iteration

Apparently the XFS attr_list_by_handle ioctl has never actually
copied the cursor contents back to user space, which means that
iteration has never worked.  Add a test case for this and see

"xfs: in _attrlist_by_handle, copy the cursor back to userspace".

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/dmerror: fix mount option issues
Darrick J. Wong [Thu, 4 Aug 2016 00:34:35 +0000 (17:34 -0700)]
common/dmerror: fix mount option issues

Calling _mount doesn't work when we want to add mount options such
as realtime devices. Fix it by calling _scratch_options first then
mount with $SCRATCH_OPTIONS.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/128: cycle_mount the scratch device
Darrick J. Wong [Wed, 3 Aug 2016 22:48:55 +0000 (15:48 -0700)]
xfs/128: cycle_mount the scratch device

This test uses the scratch device, so cycle that, not the test dev.
This is also a xfs_fsr test, so put it in the fsr group.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: optionally test xfs_repair index rebuilding
Darrick J. Wong [Wed, 3 Aug 2016 22:45:36 +0000 (15:45 -0700)]
common/rc: optionally test xfs_repair index rebuilding

Run xfs_repair twice more at the end of each test -- once to rebuild
the btree indices, and again with -n to check the rebuild work.
This is in addition to the regular dry-run spot check.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/234: use scratch device helpers
Darrick J. Wong [Thu, 21 Jul 2016 23:47:26 +0000 (16:47 -0700)]
xfs/234: use scratch device helpers

Use the helper functions for scratch devices. This fixes a problem
where xfs/234 fails when there's a realtime device.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/179: use scratch device helpers
Darrick J. Wong [Thu, 21 Jul 2016 23:47:19 +0000 (16:47 -0700)]
xfs/179: use scratch device helpers

Use the helper functions for scratch devices. This fixes a problem
where xfs/179 fails when there's a realtime device.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/129: fix post-metadump remounting idiocy
Darrick J. Wong [Thu, 21 Jul 2016 23:47:07 +0000 (16:47 -0700)]
xfs/129: fix post-metadump remounting idiocy

Use the standard _scratch_mount to mount the filesystem from the
restored image, instead of trying to call mount directly. This is
needed in case we had custom mount options (like rtdev).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/reflink: actually test dedupe on scratch device
Darrick J. Wong [Thu, 21 Jul 2016 23:46:48 +0000 (16:46 -0700)]
common/reflink: actually test dedupe on scratch device

In _require_scratch_dedupe, test the scratch device, not the
testdev.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: list the new log redo items
Darrick J. Wong [Thu, 21 Jul 2016 23:46:42 +0000 (16:46 -0700)]
xfs/122: list the new log redo items

List the new log redo items. These should have stable sizes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/310: fix the size calculation for the huge device
Darrick J. Wong [Thu, 21 Jul 2016 23:46:35 +0000 (16:46 -0700)]
xfs/310: fix the size calculation for the huge device

Fix the calculation of the dmhuge size. The previous calculation
tried to calculate the size correctly, but got it wrong for 1k block
sizes. Therefore, clean the whole mess up.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: use rmapbt-checking helper
Darrick J. Wong [Thu, 21 Jul 2016 23:46:29 +0000 (16:46 -0700)]
xfs: use rmapbt-checking helper

Don't open-code _notrun checks for the rmapbt, just use the helper.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/26[34]: remove duplicate tests
Darrick J. Wong [Thu, 21 Jul 2016 23:46:21 +0000 (16:46 -0700)]
xfs/26[34]: remove duplicate tests

These two tests were accidentally double-added as xfs/30[78], but
the newer versions have fixed up helper usage and fewer whitespace
problems, so nuke the old tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/095: update warning whitelist
Christoph Hellwig [Mon, 1 Aug 2016 09:02:56 +0000 (11:02 +0200)]
generic/095: update warning whitelist

The recent direct I/O path refactor changed the function name in the
racing read case.  Update the test case to handle the new name in
addition to the old one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocheck: allow comments in exclude files
Omar Sandoval [Sun, 31 Jul 2016 21:53:44 +0000 (14:53 -0700)]
check: allow comments in exclude files

Sometimes it's useful to keep track of why we're excluding a particular
test. Technically, we can include whatever explanation we want in the
exclude file since we just grep for the test names, but properly
supporting comments is a little more robust. This patch makes it so that
the rest of a line after a '#' is ignored.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agooverlay: truncate running binaries from lower and upper dirs
Eryu Guan [Mon, 25 Jul 2016 17:10:23 +0000 (01:10 +0800)]
overlay: truncate running binaries from lower and upper dirs

Test truncate running executable binaries from lower and upper dirs.
truncate(2) should return ETXTBSY, not other errno nor segfault

Commit 03bea6040932 ("ovl: get_write_access() in truncate") fixed
this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agooverlay: remove stale file from upperdir
Eryu Guan [Mon, 25 Jul 2016 15:37:22 +0000 (23:37 +0800)]
overlay: remove stale file from upperdir

The upper dentry may become stale before we remove it from overlay,
e.g. file was removed from upperdir directly, which triggered
warning/oops in ovl_remove_and_whiteout().

Commit cfc9fde0b07c ("ovl: verify upper dentry in
ovl_remove_and_whiteout()") fixed this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agooverlay: dump overlay private xattr
Eryu Guan [Mon, 25 Jul 2016 14:04:20 +0000 (22:04 +0800)]
overlay: dump overlay private xattr

Test dump overlay private xattr on overlayfs with multiple lower
dirs. All the lower layers, except the lowest one, should honor
overlay private xattr "trusted.overlay", which means it should not
be visible to user.

Commit b581755b1c56 ("ovl: xattr filter fix") fixed this issue.

Reviewed-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: run write(2) and fallocate(2) in parallel
Wang Xiaoguang [Mon, 25 Jul 2016 07:43:30 +0000 (15:43 +0800)]
generic: run write(2) and fallocate(2) in parallel

Currently in btrfs, there is something wrong with fallocate(2)'s
data space reservation, it'll temporarily occupy more data space
thant it really needs, which in turn will impact other operations'
data request.

In this test case, it runs write(2) and fallocate(2) in parallel and
the total needed data space for these two operations don't exceed
whole fs free data space, to see whether we will get any unexpected
ENOSPC error.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/106: rewrite to make it a reliable regression test
Zorro Lang [Fri, 22 Jul 2016 10:24:06 +0000 (18:24 +0800)]
xfs/106: rewrite to make it a reliable regression test

xfs/106 is testing basic functions of xfs_quota command, but
there're three problems prevent people from running it as a reliable
regression test (i.e. it's not in 'auto' group):

- It tests unavailable commands in current xfs_quota, e.g. "warn"
- Lack of test coverage of important commands, e.g. "disable,
  enable, off and remove" commands
- Test output doesn't match golden image

So rewrite this case to test as many xfs_quota sub-commands and
options as possible and add it to 'auto' group, except:

- some "-v" options
- all "-a" options, because it's hard to get deterministic output
- default quota, this should be already covered by other tests
- project command options, I will write another case to test it
- report command -l option, which is a new option and will cause
  failure when testing with xfsprogs prior to 3.1 version.
- quot command -c option, which may output different histogram in
  different systems or hosts.
- warn command, which is not currently implemented.
- print, df, free, help, quit and path commands.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/235: Fix false failures for some quota formats
Jan Kara [Thu, 21 Jul 2016 08:55:06 +0000 (10:55 +0200)]
generic/235: Fix false failures for some quota formats

Different quota format may print additional information in
repquota(8) output after standard quota information is printed. If
format does support this additional printouts, repquota(8) will
separate possible output by two empty lines even if format handler
doesn't actually printout anything (which is currently always the
case for queries test generic/235 does). If format doesn't support
additional printouts, these two empty lines are not present in the
output. This inconsistency causes false failures for some quota
formats.

Fix the problem by filtering out empty lines out of repquota(8)
output.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs: Update quick and auto tag for btrfs group
Qu Wenruo [Thu, 21 Jul 2016 08:13:15 +0000 (16:13 +0800)]
btrfs: Update quick and auto tag for btrfs group

Update the following quick/auto tag based on their execution time

btrfs/007
btrfs/050
btrfs/100
btrfs/101

Two systems are used to determine their execution time.  One is
backed by an SATA spinning rust, whose maximum R/W speed is about
100MB/s, modern desktop performance. (VM1)

Another one is a VM inside a openstack pool, with stronger CPU and
memory performance along with high latency storage.  Maximum R/W
speed is around 150MB/s, latency is much higher than normal HDD
though. (VM2)

The 'quick' standard is a little more restrict, only when both
systems pass the test within 30s(+/- 10%), while 'auto' is less
restrict, any system can pass within 5min(+/- 10%) will still stay
in 'auto' group.

Other test cases don't fit both standards on both systems will not
be modified.

Execution time result: (Unit: seconds)
------------------------------------------------------
Test case No. | VM1        | VM2      | Modification |
------------------------------------------------------
btrfs/007     | 4          | 2        | +quick       |
btrfs/050     | 4          | 13       | +quick       |
btrfs/100     | 57         | 151      | -quick       |
btrfs/101     | 45         | 59       | -quick       |
------------------------------------------------------

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/filter: Improve xfs_io filter
Jan Kara [Thu, 21 Jul 2016 06:15:19 +0000 (08:15 +0200)]
common/filter: Improve xfs_io filter

On my test setup xfs_io reports 'nan' in bytes/s and ops/s fields
when the operation takes zero time. Account for that in
_filter_xfs_io.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/294: Filter backquotes from mknod error output
Jan Kara [Thu, 21 Jul 2016 06:17:35 +0000 (08:17 +0200)]
generic/294: Filter backquotes from mknod error output

Really old versions of coreutils (mine are 8.12) quote a filename in the
output with a backquote in the beginning and normal quote in the end.
Improve _filter_mknod to handle that.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/075,112: fix up fsx error handling
Eric Sandeen [Tue, 19 Jul 2016 19:53:25 +0000 (12:53 -0700)]
generic/075,112: fix up fsx error handling

When fsx fails we try to copy failure state to the results/
dir, but in some cases we are using $seqres instead of
$seq or $seq instead of $here/$seq; fix this up so the
failure state is accurately captured in the results/ dir.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs: send on fully deduped file
Qu Wenruo [Tue, 19 Jul 2016 02:44:02 +0000 (10:44 +0800)]
btrfs: send on fully deduped file

For fully deduped file, whose file extents are all pointing to the
same extent, btrfs backref walk can be very time consuming, long
enough to trigger softlock.

Unfortunately, btrfs send is one of the caller of such backref walk
under an O(n) loop, making the total time complexity to O(n^3) or
more.

And even worse, btrfs send will allocate memory in such loop, to
trigger OOM on system with small memory(<4G).

This test case will check if btrfs send will cause these problems.

Reporeted-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/083: disable dmesg check
Xiao Yang [Tue, 12 Jul 2016 05:41:44 +0000 (13:41 +0800)]
xfs/083: disable dmesg check

xfs/083 will corrupt the fs intentionally, there will be WARNINGs
in dmesg as expected, so here disable dmesg check.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: Add mkfs input validation tests
Jan Tulak [Thu, 14 Jul 2016 12:43:34 +0000 (14:43 +0200)]
xfs: Add mkfs input validation tests

mkfs.xfs does not do a very good job of input validation. This test
is designed to exercise the input validation and test good/bad
combinations of options being set. It will not pass on an old
mkfs.xfs binary - it is designed to be the test case for an input
validation cleanup (merged in spring/summer 2016).

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocheck: remove unused variable
Jan Tulak [Thu, 14 Jul 2016 12:43:31 +0000 (14:43 +0200)]
check: remove unused variable

After the previous patch moved few lines of code, one seqnum
assignment is now immediately overwritten by another. Remove the
useless one.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocheck: fix extended names handling
Jan Tulak [Thu, 14 Jul 2016 12:43:30 +0000 (14:43 +0200)]
check: fix extended names handling

The code handling "./check foo/123", when the real test is
"foo/123-bar-baz" was moved to the earliest position, so everything
working with the test name or path will know the full name. Thus, no
"123" and "123-bar-baz" mix is possible.

An example of this issue is $testname.notrun file. When _notrun
"foo" was run during ./check foo/$name command, it created
$name.notrun. But few lines later, it wanted $fullname.notrun. So if
you did ./check foo/999, but the file was 999-bar-baz, then you got
comparing outputs (and most likely a fail) instead of a skip.

Another example of this mix is in xfstests output:
./check xfs/999
[...]
xfs/999 0s ... 0s
Ran: xfs/999-test-case

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobuild: Fix installation for extended names
Jan Tulak [Mon, 11 Jul 2016 09:26:06 +0000 (11:26 +0200)]
build: Fix installation for extended names

xfstests supports extended test names like 314-foo-bar, but
installation of these tests was skipped (not matching a regexp). So
this patch fixes the makefiles in tests/*/

The include/buildrules change was written by Dave Chinner.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/120: requires working *atime mount options
Christoph Hellwig [Mon, 18 Jul 2016 08:07:33 +0000 (11:07 +0300)]
generic/120: requires working *atime mount options

So call _require_atime to avoid spurious failures on NFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: fix wrong seq order in group file
Eryu Guan [Fri, 15 Jul 2016 04:59:21 +0000 (12:59 +0800)]
xfs: fix wrong seq order in group file

006 and 007 are in reverse order, and this breaks tools to find the
next available seq number in group file (e.g. tools/nextid).

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: avoid mkfs option conflicts in _scratch_mkfs_xfs_supported
Eryu Guan [Fri, 15 Jul 2016 04:20:51 +0000 (12:20 +0800)]
common/rc: avoid mkfs option conflicts in _scratch_mkfs_xfs_supported

In recent mkfs.xfs updates in xfsprogs, commit 9090e187bc3e ("mkfs:
add respecification detection to generic parsing") added
re-specification detection to "-m" option, it causes several tests
_notrun if MKFS_OPTIONS has the same options as those being tested
in _scratch_mkfs_xfs_supported(), because they're specified multiple
times.

MKFS_OPTIONS="-m crc=0" ./check xfs/001
xfs/001 3s ... [not run] mkfs.xfs doesn't have crc feature

Fix it by creating XFS again without MKFS_OPTIONS in
_scratch_mkfs_xfs_supported(), in case there's conflict between
MKFS_OPTIONS and mkfs_opts, like what we do in _scratch_mkfs_xfs().

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric: add _require_block_device to more tests
Eryu Guan [Fri, 1 Jul 2016 03:08:41 +0000 (11:08 +0800)]
generic: add _require_block_device to more tests

generic/067 mounts $SCRATCH_DEV directly in the test, assuming it's
a block device. generic/299 and generic/300 query the size of
$SCRATCH_DEV by running 'blockdev --getsz $SCRATCH_DEV'.

So add the check to make sure $SCRATCH_DEV is a real block device in
these tests.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/096: run test only if mkfs.xfs accepts invalid inputs
Jan Tulak [Thu, 14 Jul 2016 12:43:33 +0000 (14:43 +0200)]
xfs/096: run test only if mkfs.xfs accepts invalid inputs

Because we recently changed how mkfs behaves when it gets
incorrect/invalid values, add a feature check to run this test only
on older binaries, which accepts invalid sunit values.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/rc: add _require_xfs_mkfs_validation
Jan Tulak [Thu, 14 Jul 2016 15:57:03 +0000 (17:57 +0200)]
common/rc: add _require_xfs_mkfs_validation

Add a simple way to skip a test if it is (or is not) run on mkfs
correctly validating inputs.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs: invalid rmdir issued by send operation
Filipe Manana [Sat, 2 Jul 2016 12:33:28 +0000 (13:33 +0100)]
btrfs: invalid rmdir issued by send operation

Test that an incremental send operation does not prematurely issues
rmdir operations under a particular scenario (the rmdir operation is
sent before the target directory is empty).

This issue is fixed by the following patch for the linux kernel:

  "Btrfs: incremental send, fix premature rmdir operations"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs: incremental send after removing a directory
Filipe Manana [Sat, 2 Jul 2016 12:32:38 +0000 (13:32 +0100)]
btrfs: incremental send after removing a directory

Test that, under a particular scenario, an incremental send
operation does not leak memory (which used to emit a warning in
dmesg/syslog).

This is a regression test for a btrfs kernel fix that has the title:
"Btrfs: send, fix warning due to late freeing of orphan_dir_info
structures".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs: incremental send after moving directories around
Filipe Manana [Sat, 2 Jul 2016 12:32:08 +0000 (13:32 +0100)]
btrfs: incremental send after moving directories around

Test that an incremental send operation works after doing radical
changes in the directory hierarchy that involve switching the inode
that directory entries point to.

This test exercises scenarios used to fail in btrfs and are fixed by
the following patches for the linux kernel:

 "Btrfs: send, fix failure to move directories with the same name around"
 "Btrfs: incremental send, fix invalid paths for rename operations"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agobtrfs/079: Fix wrong value passed to available space check
Qu Wenruo [Mon, 11 Jul 2016 22:27:17 +0000 (15:27 -0700)]
btrfs/079: Fix wrong value passed to available space check

Wrong value is passed to _require_fs_space, which should be in unit
of kilobyte(1024), but passed in unit of gigabyte(1024^3).

Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoext4/021: add _require_metadata_journaling
Eric Whitney [Thu, 7 Jul 2016 20:12:02 +0000 (16:12 -0400)]
ext4/021: add _require_metadata_journaling

An ext4 file system can be created without a journal, but ext4/021
presumes it will contain one.  Make that requirement explicit to
avoid unnecessary failures when testing "nojournal" file systems.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: test clearing reflink inode flag
Darrick J. Wong [Fri, 17 Jun 2016 16:40:25 +0000 (09:40 -0700)]
xfs: test clearing reflink inode flag

Check that xfs_repair can clear the reflink inode flag.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: inject errors at various parts of the deferred op completion
Darrick J. Wong [Fri, 17 Jun 2016 16:39:52 +0000 (09:39 -0700)]
xfs: inject errors at various parts of the deferred op completion

Use the error injection mechanism to test log recovery of deferred
work.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/128: use $XFS_FSR_PROG instead of xfs_fsr directly
Darrick J. Wong [Fri, 17 Jun 2016 01:47:55 +0000 (18:47 -0700)]
xfs/128: use $XFS_FSR_PROG instead of xfs_fsr directly

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agogeneric/204: increase log size for rmap/reflink
Darrick J. Wong [Fri, 17 Jun 2016 01:47:49 +0000 (18:47 -0700)]
generic/204: increase log size for rmap/reflink

We're going to need a bigger log for rmap & reflink on XFS, so
increase the size of the log and the fs appropriately.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/229: require 3GB of space
Darrick J. Wong [Fri, 17 Jun 2016 01:47:24 +0000 (18:47 -0700)]
xfs/229: require 3GB of space

This test requires 3GB of space, so check for that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/235: fix logic errors when checking rmap usage after failures
Darrick J. Wong [Fri, 17 Jun 2016 01:47:17 +0000 (18:47 -0700)]
xfs/235: fix logic errors when checking rmap usage after failures

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs/122: fix test output to reflect latest xfsprogs
Darrick J. Wong [Fri, 17 Jun 2016 01:46:58 +0000 (18:46 -0700)]
xfs/122: fix test output to reflect latest xfsprogs

Since we're getting rid of the rmapxbt, don't test for it.
Add back the log inode structure.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoxfs: configurable behavior on errors at unmount time
Zorro Lang [Tue, 5 Jul 2016 09:30:24 +0000 (17:30 +0800)]
xfs: configurable behavior on errors at unmount time

XFS used to retry forever on non-critical errors, and unmount could
hang in such case. Commit e6b3bb78962e ("xfs: add "fail at unmount"
error handling configuration") introduced an error configuration
option in sysfs(fail_at_unmount) and made this behavior
configurable.

Now test this "fail_at_unmount" behavior to make sure XFS doesn't
retry forever on error at unmount time, if configured so. Also
introduced new helpers to require/set/get sysfs attributes.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agocommon/dmerror: fix nonsensical arguments handling
Zorro Lang [Tue, 5 Jul 2016 09:30:23 +0000 (17:30 +0800)]
common/dmerror: fix nonsensical arguments handling

By default, _dmerror_load_*_table() suspends the dm device with
"--nolockfs" option. Callers have to feed two arguments to these
functions to change the behavior, with the second being 1, but the
first argument is not used at all, which doesn't make sense.

Fix it by checking if the first argument is "lockfs" and removing
"--nolockfs" option if so, or passing all options to dmsetup.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
5 years agoquota: fix generic/244 on 32-bit platforms
Theodore Ts'o [Mon, 4 Jul 2016 14:09:48 +0000 (10:09 -0400)]
quota: fix generic/244 on 32-bit platforms

The test program src/test-nextquota.c relies on atoi() to convert a
string to an *unsigned* int.  If the string represents an integer
which is greater than INT_MAX, it is undefined how atoi(3) works,
and it turns out that:

       uint id = atoi("2147483649");

results in id == 2147483649 on x86_64, and id == 2147483647 on a
32-bit x86 platform.

So use strtoul(3) instead, which is portable and technically correct

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>