Commit Graph

386 Commits

Author SHA1 Message Date
Darrick J. Wong fff869cb9c fstests: use get_block_size helper
Don't open code grabbing the block size; 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>
2016-10-07 17:18:53 +08:00
Zorro Lang a5296288d6 xfs/032: test the next block size if mkfs fails
If test on a 512b sector size device, xfs/032 will try to do:

  mkfs.xfs -s size=512 -b size=512 ...

The 512b block size is not acceptable for V5 XFS. So if mkfs.xfs
fails, try next block size (blksize *= 2) directly.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-10-07 17:18:53 +08:00
Eryu Guan 2ad510c15e xfs/287: fix wrong seq number in test
It's 287 not 285.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-29 16:04:08 +08:00
Darrick J. Wong c13342b75b xfs/207,327: fsxattr no longer has the reflink flag
The FS_XFLAG_REFLINK flag was removed from struct fsxattr prior to
the inclusion of reflink in XFS, so remove it from the test outputs.
Note that the inode flag still exists; it's simply not presented
to userspace any more.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-29 14:46:43 +08:00
Darrick J. Wong 961956168b xfs/130: don't modify files after failed mount
In xfs/130, we try to mount a filesystem with the expectation that it
will fail.  Therefore, it is inappropriate to try to write to the
mountpoint, since it could otherwise be writable.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-29 14:46:40 +08:00
Darrick J. Wong 41dfeb425e 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: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-29 14:46:21 +08:00
Eryu Guan c27a67f0e7 fstests: move now-generic xfs project quota tests generic
Now that these tests have been made generic, move them into the
generic/ dir and update group files.

xfs/133 -> generic/383
xfs/134 -> generic/384
xfs/196 -> generic/385
xfs/262 -> generic/386

Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-23 12:30:04 +08:00
Eric Sandeen 7369e9c7f9 xfs: make some xfs project quota tests generic
This patch makes some xfs project quota tests generic,
so that there is at least some coverage on ext4 for this
(semi-)new feature.

It requires bleeding edge xfsprogs, so that xfs_quota and
xfs_io's chproj command can operate on "foreign" filesystems,
and requires relatively new e2fsprogs to enable the project
quota feature on-disk.

The mechanism for enabling project quota on ext4 is a bit
arcane, but hopefully I've encapsulated it reasonably well here.

Changes:

* look for "project" feature in _require_prjquota
* look for accounting not enforcement (-P) in _require_prjquota
* add a _scratch_enable_pquota to turn on project quota feature
* s/pquota/quota/ in _qmount_option for ext4
* add helper to test for xfs_io chproj on foreign filesystems
* switch from block to inode quota in xfs/133 because empty
  ext4 dirs consume one block
* cosmetic/generic changes for mkfs, require tests, etc.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-09-23 12:30:04 +08:00
Eric Sandeen fe901ccaa7 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>
2016-09-23 11:35:42 +08:00
Eric Sandeen ee25b89d8c 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>
2016-09-23 10:04:57 +08:00
Eric Sandeen bda2cdea40 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>
2016-09-23 10:04:57 +08:00
Eryu Guan a68323584d 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>
2016-09-23 10:04:28 +08:00
Zorro Lang 81dc4bc728 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>
2016-09-15 12:26:58 +08:00
Xiao Yang f4a4c64c29 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>
2016-09-15 12:26:49 +08:00
Darrick J. Wong 06d400134e 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>
2016-09-08 19:36:13 +08:00
Darrick J. Wong c49136ef66 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>
2016-09-08 19:33:14 +08:00
Qu Wenruo d67700c75a 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>
2016-09-08 14:10:57 +08:00
Eryu Guan 14a7fdfab1 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>
2016-09-08 13:55:13 +08:00
Darrick J. Wong 2db29c7d6f 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>
2016-09-02 16:40:34 +08:00
Darrick J. Wong 5324dcbbb0 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>
2016-09-02 16:40:34 +08:00
Darrick J. Wong bb5bd55108 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>
2016-09-02 16:40:34 +08:00
Darrick J. Wong a381fcbc67 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>
2016-09-02 16:40:34 +08:00
Darrick J. Wong acede2049a 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>
2016-09-02 16:40:33 +08:00
Darrick J. Wong 5bcb0b7d8c 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>
2016-09-02 16:40:20 +08:00
Darrick J. Wong 5ca088bdd2 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>
2016-09-02 16:40:08 +08:00