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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>