xfstests-dev.git
3 months agoxfs/{422,517}: kill background jobs on test termination v2022.06.26
Amir Goldstein [Tue, 21 Jun 2022 17:37:29 +0000 (20:37 +0300)]
xfs/{422,517}: kill background jobs on test termination

Those tests failed to cleanup background jobs properly after test
is interrupted and even sometimes when it completed succefully.

xfs/517 would sometime fails randomally with this false positive error:
     QA output created by 517
     Format and populate
     Concurrent fsmap and freeze
    +Terminated
     Test done

The tests have several background sub-shells that spawn short lived
programs in a loop.  By killing the spawned programs using killall,
killall could find no process to kill and the sub-shell loop could still
spawn another process that is not going to be killed and in the worst
case, the freeze_loop() could spawn the xfs_io "freeze" command after
test has thawn the fs before exit, which leaves the fs frozen after the
test.

The "Terminated" output is emitted by the sub-shell when killing the
programs that it has spawned when the loop did not finish before test
timeout.  By killing the sub-shell and not the spawned programs, we
avoid the false positive "Terminated" error.

Use a helper to perform this cleanup dance:
First kill and wait the freeze_loop so it won't try to freeze fs again
Then make sure fs is not frozen.
Then kill and wait for the rest of the sub-shells, because
if fs is frozen a killed writer process will never exit.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agofstests: unfreeze fs on cleanup routines
Amir Goldstein [Tue, 21 Jun 2022 17:37:28 +0000 (20:37 +0300)]
fstests: unfreeze fs on cleanup routines

Many of tests that freeze fs do not make sure that fs is unfrozen on
test termination.

Some tests also need to kill and wait for writer processes after
unfreezing the fs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agofstests: add missing _require_freeze() to tests
Amir Goldstein [Tue, 21 Jun 2022 17:37:27 +0000 (20:37 +0300)]
fstests: add missing _require_freeze() to tests

And add a few tests that use freeze to the freeze group

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoext4/053: test changing test_dummy_encryption on remount
Eric Biggers [Thu, 23 Jun 2022 18:41:13 +0000 (11:41 -0700)]
ext4/053: test changing test_dummy_encryption on remount

The test_dummy_encryption mount option isn't supposed to be settable or
changeable via a remount, so add test cases for this.  This is a
regression test for a bug that was introduced in Linux v5.17 and fixed
in v5.19-rc3 by commit 85456054e10b ("ext4: fix up test_dummy_encryption
handling for new mount API").

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoxfs/122: escape %zu in printf with %% not \\%
Eric Sandeen [Mon, 20 Jun 2022 21:43:31 +0000 (16:43 -0500)]
xfs/122: escape %zu in printf with %% not \\%

The standard way to escape % in a printf is with %%; although \\%zu
seems to have worked in awk until recently, an upgrade on Fedora 36
has started failing:

awk: cmd. line:1: (FILENAME=- FNR=1) fatal: not enough arguments to satisfy format string
        'printf("sizeof(%s) = \%zu\n", sizeof(%s));
    '
                                              ^ ran out for this one
Switching the escape to "%%" fixes this for me, and also works
on my very old RHEL7 mcahine.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocheck: remove err and first_test variables
David Disseldorp [Mon, 20 Jun 2022 19:29:34 +0000 (21:29 +0200)]
check: remove err and first_test variables

tc_status can be used for both of these.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocheck: use arrays instead of separate n_ counters
David Disseldorp [Mon, 20 Jun 2022 19:29:33 +0000 (21:29 +0200)]
check: use arrays instead of separate n_ counters

The separate n_try, n_bad and n_notrun counters are unnecessary when
the corresponding lists are switched to bash arrays.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoreport: fix xunit tests count
David Disseldorp [Mon, 20 Jun 2022 19:29:32 +0000 (21:29 +0200)]
report: fix xunit tests count

The xunit "section report" provides a tests attribute, which according
to https://llg.cubic.org/docs/junit/ represents:
tests=""     <!-- The total number of tests in the suite, required. -->

The current value is generated as a sum of the $n_try and $n_notrun
counters. This is incorrect as the $n_try counter already includes tests
which are run but complete with _notrun.
One special case exists for $showme (check -n), where $n_try remains
zero, so $n_notrun can be used as-is.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoreport: drop unused _xunit_make_section_report parameter
David Disseldorp [Mon, 20 Jun 2022 19:29:31 +0000 (21:29 +0200)]
report: drop unused _xunit_make_section_report parameter

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocheck: simplify check.time parsing
David Disseldorp [Mon, 20 Jun 2022 19:29:30 +0000 (21:29 +0200)]
check: simplify check.time parsing

There's no need to use grep and awk when the latter can do all that's
needed, including the pretty printing.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocheck: avoid FSTYP=<fstyp parameter> repetition
David Disseldorp [Mon, 20 Jun 2022 19:29:29 +0000 (21:29 +0200)]
check: avoid FSTYP=<fstyp parameter> repetition

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agogeneric/486: adjust the max xattr size
Luís Henriques [Mon, 13 Jun 2022 11:31:42 +0000 (12:31 +0100)]
generic/486: adjust the max xattr size

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.  And
since it reports 4M as the blocksize (the default ceph object size),
generic/486 will fail in ceph because the XATTR_SIZE_MAX value can't be used
in attr_replace_test.

The fix is to add a new argument to the test so that the max size can be
passed in instead of trying to auto-probe a value for it.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agogeneric/020: adjust max_attrval_size for ceph
Luís Henriques [Mon, 13 Jun 2022 11:31:41 +0000 (12:31 +0100)]
generic/020: adjust max_attrval_size for ceph

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.

This patch fixes the max_attrval_size for ceph so that it is takes into
account any already existing attrs in the file.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoxfs: Verify correctness of upgrading an fs to support large extent counters v2022.06.12
Chandan Babu R [Sat, 11 Jun 2022 11:10:37 +0000 (16:40 +0530)]
xfs: Verify correctness of upgrading an fs to support large extent counters

This commit adds a test to verify upgrade of an existing V5 filesystem to
support large extent counters.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoxfs: Verify that the correct inode extent counters are updated with/without nrext64
Chandan Babu R [Sat, 11 Jun 2022 11:10:36 +0000 (16:40 +0530)]
xfs: Verify that the correct inode extent counters are updated with/without nrext64

This commit adds a new test to verify if the correct inode extent counter
fields are updated with/without nrext64 mkfs option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon/xfs: Add helper to check if nrext64 option is supported
Chandan Babu R [Sat, 11 Jun 2022 11:10:35 +0000 (16:40 +0530)]
common/xfs: Add helper to check if nrext64 option is supported

This commit adds a new helper to allow tests to check if xfsprogs and xfs
kernel module support nrext64 option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agoxfs/270: Fix ro mount failure when nrext64 option is enabled
Chandan Babu R [Sat, 11 Jun 2022 11:10:34 +0000 (16:40 +0530)]
xfs/270: Fix ro mount failure when nrext64 option is enabled

With nrext64 option enabled at run time, the read-only mount performed by the
test fails because,
1. mkfs.xfs would have calculated log size based on reflink being enabled.
2. Clearing the reflink ro compat bit causes log size calculations to yield a
   different value.
3. In the case where nrext64 is enabled, this causes attr reservation to be
   the largest among all the transaction reservations.
4. This ends up causing XFS to require a larger ondisk log size than that
   which is available.

This commit fixes the problem by setting features_ro_compat to the value
obtained by the bitwise-OR of features_ro_compat field with 2^31.

This commit includes changes suggested by Dave Chinner to replace bashisms
with invocations to inline awk scripts.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agobtrfs/220: zoned: skip nodatacow mount option for zoned btrfs
Naohiro Aota [Tue, 7 Jun 2022 08:06:35 +0000 (17:06 +0900)]
btrfs/220: zoned: skip nodatacow mount option for zoned btrfs

The nodatacow mount option is not allowed on zoned btrfs and failing the
test. Skip the cases for zoned btrfs.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
3 months agocommon/filter: filter out extra mount error output
Zorro Lang [Fri, 27 May 2022 12:11:15 +0000 (20:11 +0800)]
common/filter: filter out extra mount error output

The lastest mount command (from util-linux) merged below commit:
  79534c0d7e0f ("mount: add hint about dmesg(8) to error messages")
which brought in a new error output when mount fails, no matter
ro/rw/busy mount fails.

That cause some cases (e.g. xfs/005) fail as:
  mount: Structure needs cleaning
         dmesg(1) may have more information after failed mount system call

More failed cases like generic/050, ext4/002, xfs/154, xfs/158 etc.
Especially xfs/154 and xfs/158, need to change their _filter_scratch
to _filter_error_mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
4 months agoxfs: corrupted xattr should not block removexattr
Zorro Lang [Fri, 3 Jun 2022 08:24:57 +0000 (16:24 +0800)]
xfs: corrupted xattr should not block removexattr

After we corrupted an attr leaf block (under node block), getxattr
might hit EFSCORRUPTED in xfs_attr_node_get when it does
xfs_attr_node_hasname. A known bug cause xfs_attr_node_get won't do
xfs_buf_trans release job, then a subsequent removexattr will hang.

This case covers a1de97fe296c ("xfs: Fix the free logic of state in
xfs_attr_node_hasname")

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
4 months agoxfs/189: systemd monitoring of /etc/fstab sucks v2022.06.05
Dave Chinner [Fri, 3 Jun 2022 01:54:13 +0000 (11:54 +1000)]
xfs/189: systemd monitoring of /etc/fstab sucks

On a recently upgraded system, xfs/189 still works just fine, but
every test run after it now gets spammed from mount/systemd
like so:

xfs/189 [not run] noattr2 mount option not supported on /dev/vdc
xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 1s
xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/193 2s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/194 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.

This is because xfs/189 modifies /etc/fstab during the test, then
restores it to it's original condition so there's nothing to update.
However, systemd is sees that the mtime of /etc/fstab has changed,
and assumes they sky has fallen and so everything must be reloaded
from scratch to silence the unnecessary "hint".

We can avoid this clumsiness by capturing the mtime of /etc/fstab
before we modify it, and restore it afterwards and that means
systemd doesn't even notice that we've being playing around with
/etc/fstab.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/167: adjust runtime with TIME_FACTOR
Dave Chinner [Thu, 2 Jun 2022 00:31:25 +0000 (10:31 +1000)]
xfs/167: adjust runtime with TIME_FACTOR

xfs/167 takes between 6 and 10 minutes to run on my SSD based test
machines. It's running 50 loops of a unwritten extent conversion
test program whilst running a heavy fsstress workload in the
background. This does not need to run for 10 minutes on every auto
group regression test run. Shorten it to loop 5 * TIME_FACTOR
so that normal runtime drops to something sane but can still be
easily ramped up if soak/stress testing is being run.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/070: filter the bad sb magic number error
Dave Chinner [Thu, 2 Jun 2022 00:31:24 +0000 (10:31 +1000)]
xfs/070: filter the bad sb magic number error

Lastest XFS kernel makes the superblock bad magic number error
message more meaningful, and that's being picked up by xfsprogs in
very short order. And, of course, the error is output by xfs_repair,
too, and it's been captured in the golden output of a test. Fix it
by filtering the output back down to the old message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/538: fix fsstress scaling
Dave Chinner [Thu, 2 Jun 2022 00:31:23 +0000 (10:31 +1000)]
xfs/538: fix fsstress scaling

_scale_fsstress_args() does time/load scaling of parameters. Doing
it also in the test causes exponential scaling instead of linear
scaling as the time/load parameters are meant to do.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/038: kill background threads on interrupt
Dave Chinner [Thu, 2 Jun 2022 00:31:22 +0000 (10:31 +1000)]
generic/038: kill background threads on interrupt

When I ctrl-c g/038, it either does nothing or it leaves processes
running in the background. It is not cleaning up it's background
processes correctly, so add kill vectors into the cleanup. Make sure
we only kill in the cleanup trap if the background processes are
running.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/081: don't run on DAX capable devices
Dave Chinner [Thu, 2 Jun 2022 00:31:21 +0000 (10:31 +1000)]
generic/081: don't run on DAX capable devices

LVM/DM has conniptions when you try to use snapshots on a device
that has DAX capability. It first sets up the underlying device as a
DAX capable mapping (type 3 or DM_TYPE_DAX_BIO_BASED) but because
snapshots require COW and shared mappings, it isn't supported on DAX
capable devices. Hence creating the snapshot device fails because it
requires a type 1 (DM_TYPE_BIO_BASED) device and DM can't change
types on a loaded mapping.

Hence we get this obscure error message in the log:

device-mapper: ioctl: can't change device type (old=3 vs new=1) after initial table load.

and these obscure, unhelpful error messages from the LVM command
outputs:

  device-mapper: reload ioctl on  (251:0) failed: Invalid argument
  Failed to suspend logical volume vg_081/base_081.
  Device vg_081-base_081-real (251:1) is used by another device.
  Failed to revert logical volume vg_081/base_081.
  Aborting. Manual intervention required.
Failed to create snapshot

How to turn off DAX capability is not documented in dmsetup or LVM
man pages, nor is dax mentioned anywhere in
Documentation/admin/device-mapper/ so I have no idea how to tell
LVM/DM "don't try to enable DAX support!".

As such, if the uderlying block device is dax capable, skip this
test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoREADME: document _begin_fstests better
Dave Chinner [Thu, 2 Jun 2022 00:31:20 +0000 (10:31 +1000)]
README: document _begin_fstests better

Because how it actually gets used by the fstests infrastructure
has been undocumented and that has impact on how it should be set
up.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: Add Log Attribute Replay test
Allison Henderson [Fri, 3 Jun 2022 01:41:12 +0000 (11:41 +1000)]
fstests: Add Log Attribute Replay test

This patch adds tests to exercise the log attribute error
inject and log replay. These tests aim to cover cases where attributes
are added, removed, and overwritten in each format (shortform, leaf,
node). Error inject is used to replay these operations from the log.

dchinner: sanitise md5sum input to just attr values.
dchinner: correct md5sums.
dchinner: ensure replace tests use different values so recovery can
          determine the replace was replayed correctly.
dchinner: don't remove corpse in _cleanup - scratch devices don't
  require cleanup, and if the test fails we want to leave
  the broken state for post-mortem analysis.
dchinner: only run on v5 filesystems.

[zlang: restore the old value of /sys/fs/xfs/debug/larp]

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/591: use proper sector size
Zorro Lang [Tue, 31 May 2022 07:45:01 +0000 (15:45 +0800)]
generic/591: use proper sector size

The generic/591 fails if the sector size of TEST_DEV isn't 512:

  splice-test: write: /mnt/test/a: Invalid argument

To fix this issue, this patch help src/splice-test.c to get a specify
sector size from the test case. Then let g/591 give it a proper
sector size which dio aligned.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
4 months agogeneric/591: remove redundant output from golden image
Zorro Lang [Sun, 29 May 2022 08:13:25 +0000 (16:13 +0800)]
generic/591: remove redundant output from golden image

In generic/591.out expects below output:
  concurrent reader with O_DIRECT
  concurrent reader with O_DIRECT     <=== ???
  concurrent reader without O_DIRECT
  concurrent reader without O_DIRECT  <=== ???
  sequential reader with O_DIRECT
  sequential reader without O_DIRECT

The lines marked "???" are unbelievable, due to the src/splice-test.c
only calls printf to output that message once in main function. So
Why splice-test prints that message twice sometimes? It seems related
with the "-r" option, due to the test lines without "-r" option only
print one line each time running.

A stanger thing is this "double output" issue only can be triggered by
running g/591, can't reproduce it by running splice-test manually.

By checking the code of splice-test.c, I found a "fork()" in it, and
it'll be called if the '-r' option is specified. So I suspect the
redundant output come from the child process. By the help of strace
tool, I got:

  10554 execve("/root/git/xfstests/src/splice-test", ["/root/git/xfstests/src/splice-te"..., "-r", "/mnt/test/a"], 0x7ffcabc2c0a8 /* 202 vars */) = 0
  ...
  10554 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f937f5d5a10) = 10555
  ...
  10555 read(4, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 512) = 512
  10555 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10555 exit_group(0)                     = ?
  10555 +++ exited with 0 +++
  10554 <... wait4 resumed>NULL, 0, NULL) = 10555
  10554 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10555, si_uid=0, si_status=0, si_utime=0, si_stime=1} ---
  10554 unlink("/mnt/test/a")             = 0
  10554 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10554 exit_group(0)                     = ?
  10554 +++ exited with 0 +++

We can see the "concurrent reader with O_DIRECT\n" be printed by
parent process 10554 and child process 10555 separately.

Due to the stdout redirection that fstests does cause the stream
doesn't refer to a tty anymore, then the stdout become block
buffered, so the '\n' doesn't help to flush that printf message,
and the child print it again.

So use setlinebuf(stdout) to force it line buffered, to avoid the
confused output to be golden image. Then correct the generic/591.out

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
4 months agogeneric/506: call _require_quota before _qmount
Zorro Lang [Sun, 29 May 2022 09:03:36 +0000 (17:03 +0800)]
generic/506: call _require_quota before _qmount

The g/506 fails on some filesystems (e.g. overlay) which doesn't
support prjquota:

  MOUNT_OPTIONS =  -o prjquota
  qmount failed

To avoid this failure, call _require_quota before doing real quota
mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
4 months agogeneric/139: require 512 bytes to be the minimum dio size
Zorro Lang [Thu, 2 Jun 2022 05:17:16 +0000 (13:17 +0800)]
generic/139: require 512 bytes to be the minimum dio size

Due to generic/139 tests base on 512 bytes aligned, so skip this test
if the minimum dio write size >512. This patch also change the
common/rc::_require_dio helper, supports a minimum aligned size
argument.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
4 months agocommon/rc: Fix _require_batched_discard to skip test correctly
Liu Yiding [Tue, 31 May 2022 07:12:52 +0000 (15:12 +0800)]
common/rc: Fix _require_batched_discard to skip test correctly

xfstest commit ee264b3f ("common/rc: Modify _require_batched_discard to
improve test coverage") changed the way of determing if discard is
supported by checking whether fstrim output contains "not supported"
keywords.

On RHEL, fstrim output below info when discard is not supported
"fstrim: /mnt/share0/: FITRIM ioctl failed: Function not implemented"

Supplyment unsupported keywords to _require_batched_discard.

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoext4/053: update the test_dummy_encryption tests
Eric Biggers [Mon, 30 May 2022 17:30:44 +0000 (10:30 -0700)]
ext4/053: update the test_dummy_encryption tests

Kernel commit 5f41fdaea63d ("ext4: only allow test_dummy_encryption when
supported") tightened the requirements on when the test_dummy_encryption
mount option is accepted.  Update ext4/053 accordingly.

Move the test cases to later in the file to group them with the other
test cases that use do_mkfs to add custom mkfs options instead of using
the "default" filesystem that the test creates at the beginning.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric: adjust strict SPO recovery testcases for f2fs
Chao Yu [Sat, 21 May 2022 03:16:21 +0000 (11:16 +0800)]
generic: adjust strict SPO recovery testcases for f2fs

Testcases like generic 342/502/526/527 expect that filesystems will
recover all related metadata changes to the file which was fsynced
before sudden power off.

This patch adjusts to use "fsync_mode=strict" mountoption for f2fs
to pass these testcases.

Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs: test direct I/O read repair with interleaved corrupted sectors v2022.05.29
Christoph Hellwig [Fri, 27 May 2022 08:19:15 +0000 (10:19 +0200)]
btrfs: test direct I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs: test buffered I/O read repair with interleaved corrupted sectors
Christoph Hellwig [Fri, 27 May 2022 08:19:14 +0000 (10:19 +0200)]
btrfs: test buffered I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs: test repair with sectors corrupted in multiple mirrors
Christoph Hellwig [Fri, 27 May 2022 08:19:13 +0000 (10:19 +0200)]
btrfs: test repair with sectors corrupted in multiple mirrors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/215: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:12 +0000 (10:19 +0200)]
btrfs/215: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/157: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:11 +0000 (10:19 +0200)]
btrfs/157: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/143: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:10 +0000 (10:19 +0200)]
btrfs/143: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/142: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:09 +0000 (10:19 +0200)]
btrfs/142: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/141: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:08 +0000 (10:19 +0200)]
btrfs/141: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs/140: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:07 +0000 (10:19 +0200)]
btrfs/140: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agobtrfs: add a helpers for read repair testing
Christoph Hellwig [Fri, 27 May 2022 08:19:06 +0000 (10:19 +0200)]
btrfs: add a helpers for read repair testing

Add a few helpers to consolidate code for btrfs read repair testing:

 - _btrfs_get_first_logical() gets the btrfs logical address for the
   first extent in a file
 - _btrfs_get_device_path and _btrfs_get_physical use the
   btrfs-map-logical tool to find the device path and physical address
   for btrfs logical address for a specific mirror
 - _btrfs_direct_read_on_mirror and _btrfs_buffered_read_on_mirror
   read the data from a specific mirror

These will be used to consolidate the read repair tests and avoid
duplication for new tests.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/545: check for fallocate support before running test
Darrick J. Wong [Tue, 24 May 2022 19:52:19 +0000 (12:52 -0700)]
xfs/545: check for fallocate support before running test

This test fails when alwayscow mode is enabled:

 QA output created by 545
+fallocate: Operation not supported
 Creating directory system to dump using fsstress.

Fix this by checking for fallocate support first.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agotests: remove redundant common/$FSTYP importing
Zorro Lang [Thu, 26 May 2022 01:23:17 +0000 (09:23 +0800)]
tests: remove redundant common/$FSTYP importing

As fstests intensively source specific common/$FSTYP files in
common/rc, at the beginning of ./check running. Each single case
doesn't need to import that again.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
4 months agocommon: source base fs specific common file
Zorro Lang [Wed, 25 May 2022 07:34:26 +0000 (15:34 +0800)]
common: source base fs specific common file

When tests overlayfs, sometimes we need the underlying fs specific
helpers, e.g. common/rc has:
  _filesystem_timestamp_range $OVL_BASE_TEST_DEV $OVL_BASE_FSTYP

So when we source common/overlay, better to source OVL_BASE_FSTYP
too.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
4 months agoceph/001: skip metrics check if no copyfrom mount option is used
Luís Henriques [Tue, 24 May 2022 09:42:56 +0000 (10:42 +0100)]
ceph/001: skip metrics check if no copyfrom mount option is used

Checking the metrics is only valid if 'copyfrom' mount option is
explicitly set, otherwise the kernel won't be doing any remote object
copies.  Fix the logic to skip this metrics checking if 'copyfrom' isn't
used.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs: annotate fix commits for upcoming 5.10.y backports
Amir Goldstein [Fri, 20 May 2022 14:32:49 +0000 (17:32 +0300)]
xfs: annotate fix commits for upcoming 5.10.y backports

In preparation for backporting xfs fixes to stable kernel 5.10.y,
annotate some of the tests that pass after applying the backports.

Most of the annotated tests have the fix commit documented either
in comment or in commit message already.

All tests have been verified to pass with fix commits apply, but
for a few tests, a failure was observed when running on kernel without
the documented fix commit. That is probably because failure happens
only on a specific setup.

Generic tests have also been annotated with xfs fix commits.
That may produce wrong hints if the test fails on another fs, but
that is what hints are for - to give tester a hint, so if tester is
not testing xfs, it's easy to figure out that the hint is irrelevant.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoceph/002: fix test expected output
Luís Henriques [Fri, 20 May 2022 09:47:09 +0000 (10:47 +0100)]
ceph/002: fix test expected output

Commit daa0c0146c7d ("fstests: replace hexdump with od command") broke
ceph/002 by adding an extra '0' in the offset column.  Fix it.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agotools/mkgroupfile: help the cases of group.list in number order v2022.05.22
Zorro Lang [Sat, 21 May 2022 05:32:19 +0000 (13:32 +0800)]
tools/mkgroupfile: help the cases of group.list in number order

The mkgroupfile doesn't sort cases in number order, that cause
fstests' ./new script can't find a proper number which isn't taken.
The unsorted case number might cause more problems, so fix it.

Fixes: 441606d28681 ("fstests: faster group file creation")
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: fix group list generation for whacky test names
Dave Chinner [Tue, 17 May 2022 07:01:03 +0000 (17:01 +1000)]
fstests: fix group list generation for whacky test names

Darrick noticed that tests/xfs/191-input-validation didn't get
generated properly. Fix the regex to handle this.

$ grep -I -R "^_begin_fstest" tests/xfs | \
  sed -e 's/^.*\/\([0-9]*\):_begin_fstest/\1/' |grep 191
tests/xfs/191-input-validation:_begin_fstest auto quick mkfs realtime
$
$ grep -I -R "^_begin_fstest" tests/xfs | \
  sed -e 's/^.*\/\([0-9]*\).*:_begin_fstest/\1/ ' |grep 191
191 auto quick mkfs realtime
$

Use the regexes for matching test names defined in common/test_names
rather than trying to open code it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
4 months agofstests: remove xfs deprecated test
Dave Chinner [Tue, 17 May 2022 12:15:48 +0000 (20:15 +0800)]
fstests: remove xfs deprecated test

Remove xfs/018, xfs/081 and xfs/082 entirely, as they're deprecated
and obsolete for long time.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/191: remove broken test
Dave Chinner [Tue, 17 May 2022 07:01:11 +0000 (17:01 +1000)]
xfs/191: remove broken test

Test has been marked broken for a long time. Original intent of
validating all mkfs.xfs input is not realistic, nobody is going to
try to make that happen.

Remove it as it serves no useful purpose except to have a whacky
unique name that nobody expects or codes for.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/148: fix failure from bad shortform size assumptions
Dave Chinner [Tue, 17 May 2022 07:01:06 +0000 (17:01 +1000)]
xfs/148: fix failure from bad shortform size assumptions

We replaced an attr named:

slashstr="are_bad_for_you"

with this substitution:

cp $imgfile $imgfile.old
sed -b \
        -e "s/$nullstr/too_many\x00beans/g" \
        -e "s/$slashstr/are_bad\/for_you/g" \
        -i $imgfile

We then try to retreive the attr named 'a_are_bad/for_you'. The
failure is:

    -Attribute "a_are_bad/for_you" had a 3 byte value for TEST_DIR/mount-148/testfile:
    -heh
    +attr_get: No data available
    +Could not get "a_are_bad/for_you" for TEST_DIR/mount-148/testfile

The error returned is ENODATA - the xattr does not exist. While the
name might exist in the attr leaf block:

....
nvlist[0].valuelen = 3
nvlist[0].namelen = 17
nvlist[0].name = "a_are_bad/for_you"
nvlist[0].value = "heh"
nvlist[1].valuelen = 3
....

xattrs are not looked up by name matches when in leaf or node form
like they are in short form.  They are looked up by *name hash*
matches, and if the hash is not found, then the name does not exist.
Only if the has match is found, then it goes and retrieves the xattr
pointed to by the hash and checks the name.

At this point, it should be obvious that the hash of
"a_are_bad_for_you" is different to "a_a_are_bad/for_you". Hence the
leaf lookup is always rejected at the hash match stage and never
gets to the name compare stage.

IOWs, this test can *never* pass when the xattr is in leaf/node
form, only when it is in short form.

The reason the attr fork is in leaf form is that we are using
"-m crc=0" and so the inodes are only 256 bytes in size and can only
hold ~150 bytes in the literal area. That leaves ~100 bytes maximum
for shortform attr data. The test consumes ~80 bytes of shortform
space, so it should fit and the test pass.

However:

nvlist[4].valuelen = 37
nvlist[4].namelen = 7
nvlist[4].name = "selinux"
nvlist[4].value = "unconfined_u:object_r:unlabeled_t:s0\000"

Yes, I run the fstests with selinux enabled on some of test
machines. The selinux attr pushes the attr fork way over the size
that can fit in the shortform literal area, and so it moves to leaf
form as the attrs are initially added and the test fails.

Fix this by forcing the test to use 512 byte inodes, so as to
provide around 350 bytes of usable attr fork literal area so it's
not affected by security attributes.

While there, clean up the silly conditional loop device cleanup
code.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/148: make test debuggable
Dave Chinner [Tue, 17 May 2022 07:01:05 +0000 (17:01 +1000)]
xfs/148: make test debuggable

Don't clean up image files - leave them laying around on the test
device so that when the test fails there's a corpse left behind to
post-mortem....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/348: golden output is not correct
Dave Chinner [Tue, 17 May 2022 07:01:02 +0000 (17:01 +1000)]
xfs/348: golden output is not correct

The output of xfs/348 encodes the observed behaviour at the time the
test was written, not the correct behaviour that should occur.
Recent improvements in verification checking in the upstream kernel
(1eb70f54c445 "xfs: validate inode fork size against fork format")
have resulted in the kernel having correct behaviour and now the
test fails. Fix the test output to reflect correct behaviour.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/122: add attribute log formats to test output.
Dave Chinner [Tue, 17 May 2022 07:01:01 +0000 (17:01 +1000)]
xfs/122: add attribute log formats to test output.

Now that we have merged logged attributes, add the attribute log
format sizes to the on-disk structure size checking.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: filter quota warnings
Dave Chinner [Tue, 17 May 2022 07:01:00 +0000 (17:01 +1000)]
fstests: filter quota warnings

Quota warning code has been removed from the upstream kernel and now
returns -EINVAL errors. Seeing as we can't set warnings anymore and
they have always been non-functional in the kernel, just remove the
calls to set warnings filter those errors out so those tests pass
again.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon/rc: fix test init performance regression on XFS
Dave Chinner [Fri, 20 May 2022 01:23:36 +0000 (11:23 +1000)]
common/rc: fix test init performance regression on XFS

I've been having problems over the past month with tests randomly
running much slower than they should. The overall effect has been
that running an auto group iterate has blown out from about 3
hours to almost 5 hours.

The problem has been that the root disks have been thrashing.
Thousands of iops and the backing store getting IO bound so all test
vms with root drive images hosted on that backing store then also
go slow.

I finally got to the bottom of it - it looked for all the world like
a qemu image format write amplification problem, because I couldn't
capture anything unusual from inside the guest. I converted all
the root images to raw format on fast SSD storage, and the problem
didn't go away - while some tests were faster, other tests were
still randomly slow.

Finally I tracked it down with blktrace/blkparse. All the IO was
coming from processes with the command line like:

 /sbin/mkfs.xfs -d file name=/tmp/791409.img size=512m

A quick grep then pointed me at common/rc::init_rc() where there is
a test for XFS specific on-disk format behaviour that uses that
exact command line.

init_rc() is run from _begin_fstest() so it is executed on every
test start. We run mkfs to create a 512MB filesystem in $tmp on
every test start. That's ..... not smart. And we do it so we can
change the setup of $XFS_COPY_PROG, which is only used in a handful
of tests. That's also .... not smart.

And then the penny dropped: we recently increased the default log
size of small filesystems, so this is now zeroing a 64MB log instead
of a 5-10MB log. And, of course it's on the root drive because of
the $tmp image prefix, which in this case is ext3, and it's
fragmenting the crap out of the writes and so it increases runtime
of the mkfs.xfs execution from nothing to 5-10s.

Then when one of these mkfs invocations co-incides with journal
flushing driven writeback, everything just stops until the writeback
stops thrashing. And so all tests are 5-10s slows, and random tests
take anywhere between 20-100s longer to start up....

Fix it by moving the setup of XFS_COPY_PROG to _require_xfs_copy()
so only the tests that use xfs_copy run this code.

Numbers don't lie:

generic/001 11s ...  6s
generic/002 9s ...  1s
generic/003 17s ...  10s
generic/004 12s ...  1s
generic/005 9s ...  1s
generic/006 9s ...  2s
generic/007 11s ...  3s
generic/008 5s ...  2s
generic/009 10s ...  2s
generic/010 5s ...  0s
generic/011 9s ...  1s
generic/012 7s ...  2s
generic/013 10s ...  5s
generic/014 11s ...  1s
generic/015 7s ...  1s
generic/016 7s ...  2s
.....

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: tests should not source common/rc directly
Dave Chinner [Fri, 20 May 2022 01:23:35 +0000 (11:23 +1000)]
fstests: tests should not source common/rc directly

_begin_fstest() does this as every test needs it, so remove it from
all the tests that source it a second time.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/556: add test case for top-level dir rename
Eric Biggers [Sat, 14 May 2022 18:01:46 +0000 (11:01 -0700)]
generic/556: add test case for top-level dir rename

Test renaming a casefolded directory located in the top-level directory,
while the cache is cold.  When $MOUNT_OPTIONS contains
test_dummy_encryption, this detects an f2fs bug.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/556: Filter touch error message
Gabriel Krisman Bertazi [Fri, 20 May 2022 17:18:52 +0000 (13:18 -0400)]
generic/556: Filter touch error message

Coreutils commit d435cfc0bc55 ("touch: fix wrong
diagnostic (Bug#48106)"), released in coreutils v9.0, changed the error
reported by the tool when openat() fails with EINVAL.  Instead of
reporting a generic message for the failure of either openat() or the
following utimensat(), it now differentiates both failures with
different messages.

This change breaks generic/556, which relied on the parsing of that
message.  This test was originally developed by me on a Debian
Buster (coreutils v8.x), so I used the generic error message.  Now that
I tried to run it on a more modern distro, it reports a different error
message, which fails the test, as shown below:

  output mismatch (see /tmp/results/generic/556.out.bad)
      --- tests/generic/556.out 2022-05-20 13:15:00.447525770 -0400
      +++ /tmp/results/generic/556.out.bad 2022-05-20 13:15:24.988167427 -0400
      @@ -12,5 +12,5 @@
       # file: SCRATCH_MNT/xattrs/x/f1
       user.foo="bar"

      -touch: setting times of 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
      -touch: setting times of 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
      +touch: cannot touch 'SCRATCH_MNT/strict/corac'$'\314\247\303': Invalid argument
      +touch: cannot touch 'SCRATCH_MNT/strict/cora'$'\303\247\303': Invalid argument
      ...

The fix filters out the touch-specific parts of the touch error
messages, to prevent breakage from future changes, but preserves the
return code information, which is actually useful (and more stable).

There is no change in behavior on the kernel side, just a broken test.
On both older and new distros, the kernel correctly rejects this invalid
sequence with -EINVAL, as shown in the strace hunk below:

  [...]
  openat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
  utimensat(AT_FDCWD, "/scratch_mnt/strict/corac\314\247\303", ...) = -1 EINVAL
  [...]

Tested on Debian sid (coreutils v8.32) and Fedora (coreutils 9.0).

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: add a btrfs read_repair group
Christoph Hellwig [Tue, 17 May 2022 06:35:02 +0000 (08:35 +0200)]
fstests: add a btrfs read_repair group

Add a new group to run all tests the exercise the btrfs read_repair code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/603: use project quota create and restore common helpers
Zorro Lang [Thu, 12 May 2022 15:16:56 +0000 (23:16 +0800)]
generic/603: use project quota create and restore common helpers

As common/quota has _create_project_quota and _restore_project_quota
helpers now, so replace local similar functions with them.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric: soft quota limits testing within grace time
Zorro Lang [Mon, 9 May 2022 17:17:22 +0000 (01:17 +0800)]
generic: soft quota limits testing within grace time

After soft limits are exceeded, within the grace time, fs quota
should allow more space allocation before exceeding hard limits,
even if allocating many small files.

This case can cover bc37e4fb5cac (xfs: revert "xfs: actually bump
warning counts when we send warnings"). And will help to expose
later behavior changes on this side.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@redhat.com>
4 months agocommon/rc: Modify _require_batched_discard to improve test coverage
Ojaswin Mujoo [Mon, 16 May 2022 08:45:05 +0000 (14:15 +0530)]
common/rc: Modify _require_batched_discard to improve test coverage

A recent ext4 patch discussed [1] that some devices (eg LVMs) can
have a discard granularity as big as 42MB which makes it larger
than the group size of ext4 FS with 1k BS.  This causes the FITRIM
IOCTL to fail.

This case was not correctly handled by this test since
"_require_batched_discard" incorrectly interpreted the FITRIM
failure as SCRATCH_DEV not supporting the IOCTL. This caused the test
to report "not run" instead of "failed" in case of large discard granularity.

Fix "_require_batched_discard" to use a more accurate method
to determine if discard is supported.

[1] commit 173b6e383d2
    ext4: avoid trim error on fs with small groups

Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agovfs/idmapped-mounts: remove invalid test v2022.05.15
Christian Brauner [Thu, 12 May 2022 16:52:50 +0000 (18:52 +0200)]
vfs/idmapped-mounts: remove invalid test

The threaded mount interaction test validates that the idmapping of a
mount behaves correctly when changed while another process already has a
writable file descriptor to that mount. In newer kernels it isn't
possible to change a mount's idmapped if someone has a writable file
descriptor to that mount.

Link: e1bbcd277a53 ("fs: hold writers when changing mount's idmapping")
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agovfstest: split out remaining idmapped mount tests
Christian Brauner [Thu, 12 May 2022 16:52:49 +0000 (18:52 +0200)]
vfstest: split out remaining idmapped mount tests

Split out all the remaining idmapped mount tests into the idmapped
mounts source file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agovfstest: split out btrfs idmapped mounts test
Christian Brauner [Thu, 12 May 2022 16:52:48 +0000 (18:52 +0200)]
vfstest: split out btrfs idmapped mounts test

Split the btrfs specific idmapped mounts test into a separate source
file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agovfstest: split idmapped mount tests into separate suite
Christian Brauner [Thu, 12 May 2022 16:52:47 +0000 (18:52 +0200)]
vfstest: split idmapped mount tests into separate suite

Now that we finished restructuring split the core idmapped mounts test
suite into a separate source file.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoutils: add struct test_suite
Christian Brauner [Thu, 12 May 2022 16:52:46 +0000 (18:52 +0200)]
utils: add struct test_suite

Provide a convenient wrapper struct which provides the tests and the
number of tests. The struct can be kept local to each source file so we
are sure that the tests and number of tests is correct.

In vfstest.c we provide a run_suite() function which expects a struct
test_suite and runs the tests provided by that suite.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agomissing: move sys_execveat() to missing.h
Christian Brauner [Thu, 12 May 2022 16:52:45 +0000 (18:52 +0200)]
missing: move sys_execveat() to missing.h

The missing.h header provides syscalls potentially missing from the used
libc. Move the sys_execveat() definition into it. It doesn't belong into
vfstest.c.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoutils: move helpers into utils
Christian Brauner [Thu, 12 May 2022 16:52:44 +0000 (18:52 +0200)]
utils: move helpers into utils

In order to split the test suite into multiple source files we need to
be able to access generic helpers in all source files not just one. So
move all generic helpers into utils.{c,h}.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoutils: add struct vfstest_info
Christian Brauner [Thu, 12 May 2022 16:52:43 +0000 (18:52 +0200)]
utils: add struct vfstest_info

So far we were able to rely on global variables as the idmapped mount
test suite was a single source file. But that gets messy when we split
it into multiple source files in the following patches. Instead of
global variables introduce struct vfstest_info which provides all
information about the test suite run and pass it to all tests.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoutils: add missing global.h include
Christian Brauner [Thu, 12 May 2022 16:52:42 +0000 (18:52 +0200)]
utils: add missing global.h include

Make sure that utils.{c,h} have access to the necessary defines created
during the configure stage when building xfstests.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agovfstest: rename struct t_idmapped_mounts
Christian Brauner [Thu, 12 May 2022 16:52:41 +0000 (18:52 +0200)]
vfstest: rename struct t_idmapped_mounts

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature.

Rename the basic structure used for the tests from struct
t_idmapped_mounts to struct test_struct.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agosrc/vfs: rename idmapped-mounts.c file
Christian Brauner [Thu, 12 May 2022 16:52:40 +0000 (18:52 +0200)]
src/vfs: rename idmapped-mounts.c file

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature. So rename the source file from
idmapped-mounts.c to vfstest.c before we split it into multiple source
files in the next patches.

[Zorro: fix generic/689]

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agosrc: rename idmapped-mounts folder
Christian Brauner [Thu, 12 May 2022 16:52:39 +0000 (18:52 +0200)]
src: rename idmapped-mounts folder

The idmapped mounts test suite has grown to cover a lot of generic vfs
functionality that is not concerned with idmapped mounts at all.

As was discussed upstream it's time to rename it to something that
reflects its generic nature. So rename it from idmapped-mounts to vfs.

[Zorro: fix generic/689 and add it into idmapped test group]

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoidmapped-mounts: make all tests set their required feature flags
Christian Brauner [Thu, 12 May 2022 16:52:38 +0000 (18:52 +0200)]
idmapped-mounts: make all tests set their required feature flags

In commit 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more
features") we introduced a flag argument to check for multiple features
and then decide based on the flag argument whether a test requires a
given feature and skip it if the kernel doesn't provide it.

However, not all tests were ported to the new flag argument and still
use the old infrastructure. Port them all.

Fixes: 858a19c5e9b0 ("idmapped_mounts: Prepare for support for more features")
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocasefold: Fix expansion of seqres variable
Gabriel Krisman Bertazi [Wed, 11 May 2022 16:33:40 +0000 (12:33 -0400)]
casefold: Fix expansion of seqres variable

seqres is not properly expanded on these error paths, causing a file
called seqres.full to be created instead.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agocommon: xfstests support overlay+tmpfs
Baokun Li [Wed, 11 May 2022 08:34:04 +0000 (16:34 +0800)]
common: xfstests support overlay+tmpfs

The local.config of overlay+tmpfs is as follows:
```local.config.example
export FSTYP=tmpfs
export TEST_DEV=tmpfs_test
export TEST_DIR=/tmp/test
export SCRATCH_DEV=tmpfs_scratch
export SCRATCH_MNT=/tmp/scratch
```

Run `./check -overlay tests` to execute test case on overlay+tmpfs.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric/68[3-7]: Add separate sgid stripping sub-tests
Yang Xu [Tue, 10 May 2022 05:24:50 +0000 (13:24 +0800)]
generic/68[3-7]: Add separate sgid stripping sub-tests

Like xfstests commit 298f60c ("generic/673: Add separate sgid stripping sub-tests"),
we should also add separate sgid stripping sub-tests for each fallocate operation.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoext4/053: fix the rejected mount option testing
Eric Biggers [Sat, 30 Apr 2022 19:21:30 +0000 (12:21 -0700)]
ext4/053: fix the rejected mount option testing

'not_mnt OPTIONS' seems to have been intended to test that the
filesystem cannot be mounted at all with the given OPTIONS, meaning that
the mount fails as opposed to the options being ignored.  However, this
doesn't actually work, as shown by the fact that the test case 'not_mnt
test_dummy_encryption=v3' is passing in the !CONFIG_FS_ENCRYPTION case.
Actually ext4 ignores this mount option when !CONFIG_FS_ENCRYPTION.
(The ext4 behavior might be changed, but that is besides the point.)

The problem is that the do_mnt() helper function is being misused in a
context where a mount failure is expected, and it does some additional
remount tests that don't make sense in that context.  So if the mount
unexpectedly succeeds, then one of these later tests can still "fail",
causing the unexpected success to be shadowed by a later failure, which
causes the overall test case to pass since it expects a failure.

Fix this by reworking not_mnt() and not_remount_noumount() to use
simple_mount() in cases where they are expecting a failure.  Also fix
up some of the naming and calling conventions to be less confusing.
Finally, make sure to test that remounting fails too, not just mounting.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agogeneric: test fsync of directory with renamed symlink
Filipe Manana [Mon, 9 May 2022 14:31:02 +0000 (15:31 +0100)]
generic: test fsync of directory with renamed symlink

Test that if we fsync a directory, create a symlink inside it, rename
the symlink, fsync again the directory and then power fail, after the
filesystem is mounted again, the symlink exists with the new name and
it has the correct content.

This currently fails on btrfs, because the symlink ends up empty (which
is illegal on Linux), but it is fixed by kernel commit:

    d0e64a981fd841 ("btrfs: always log symlinks in full mode")

Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoidmapped-mounts: Add open with O_TMPFILE operation in setgid test v2022.05.08
Yang Xu [Sat, 7 May 2022 16:01:27 +0000 (00:01 +0800)]
idmapped-mounts: Add open with O_TMPFILE operation in setgid test

Since we can create temp file by using O_TMPFILE flag and filesystem driver also
has this api, we should also check this operation whether strip S_ISGID.

Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoidmapped-mounts: Add mknodat operation in setgid test
Yang Xu [Sat, 7 May 2022 16:01:26 +0000 (00:01 +0800)]
idmapped-mounts: Add mknodat operation in setgid test

Since mknodat can create file, we should also check whether strip S_ISGID.
Also add new helper caps_down_fsetid to drop CAP_FSETID because strip S_ISGID
depend on this cap and keep other cap(ie CAP_MKNOD) because create character
device needs it when using mknod.

Only test mknodat with character device in setgid_create function and the another
two functions test mknodat with whiteout device.

Since kernel commit a3c751a50 ("vfs: allow unprivileged whiteout creation") in
v5.8-rc1, we can create whiteout device in userns test. Since kernel 5.12, mount_setattr
and MOUNT_ATTR_IDMAP was supported, we don't need to detect kernel whether allow
unprivileged whiteout creation. Using fs_allow_idmap as a proxy is safe.

Tested-by: Christian Brauner (Microsoft)<brauner@kernel.org>
Reviewed-by: Christian Brauner (Microsoft)<brauner@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoidmapped-mounts: Reset errno to zero before run_test
Yang Xu [Sat, 7 May 2022 16:01:25 +0000 (00:01 +0800)]
idmapped-mounts: Reset errno to zero before run_test

If we run case on old kernel that doesn't support mount_setattr and
then fail on our own function before call is_setgid/is_setuid function
to reset errno, run_test will print "Function not implement" error.

We also check whether system support user namespace, so reset errno to
zero after userns check.

Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agoxfs/533: Delete test since directory's extent count can never overflow
Chandan Babu R [Fri, 6 May 2022 09:57:46 +0000 (15:27 +0530)]
xfs/533: Delete test since directory's extent count can never overflow

The maximum file size that can be represented by the data fork extent counter
in the worst case occurs when all extents are 1 block in length and each block
is 1KB in size.

With XFS_MAX_EXTCNT_DATA_FORK_SMALL representing maximum extent count and with
1KB sized blocks, a file can reach upto,
(2^31) * 1KB = 2TB

This is much larger than the theoretical maximum size of a directory
i.e. XFS_DIR2_SPACE_SIZE * 3 = ~96GB.

Since a directory can never overflow its data fork extent counter, the xfs
kernel driver removed code which checked for such a situation before any
directory modification operation could be executed. Instead, the kernel driver
verifies the sanity of directory's data fork extent counter when the inode is
read from disk.

This commit removes the test xfs/533 due to the reasons mentioned above.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
4 months agofstests: faster group file creation
Dave Chinner [Fri, 6 May 2022 05:10:17 +0000 (15:10 +1000)]
fstests: faster group file creation

We don't need to execute every test just to check it's groups are
valid. Just grab all the groups with grep, pull out the unique ones,
then check them.

This also avoids the problem of editor swap files being present in
the test directory and breaking the build because they are not
executable.

Building on a clean, already built tree so it only builds the
group lists:

$ time make
....
Building udf
 [GROUP] /home/dave/src/xfstests-dev/tests/udf/group.list
Building xfs
 [GROUP] /home/dave/src/xfstests-dev/tests/xfs/group.list

real    0m36.917s
user    0m15.032s
sys     0m26.219s
$

Patched:

$ time make
....
Building udf
 [GROUP] /home/dave/src/xfstests-dev/tests/udf/group.list
Building xfs
 [GROUP] /home/dave/src/xfstests-dev/tests/xfs/group.list
groups "frobnozzle" not mentioned in documentation.
gmake[3]: *** [../../include/buildgrouplist:8: group.list] Error 1
gmake[2]: *** [../include/buildrules:31: xfs] Error 2
gmake[1]: *** [include/buildrules:31: tests] Error 2
make: *** [Makefile:51: default] Error 2

real    0m1.751s
user    0m0.863s
sys     0m1.067s

$

Just a little bit faster, and as you can see that it still detects
groups that are not documented. There was also an open .001.swp file
in the XFS directory and that doesn't throw a failure anymore,
either.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon: print hints for reasons of test failures
Amir Goldstein [Tue, 19 Apr 2022 12:56:37 +0000 (15:56 +0300)]
common: print hints for reasons of test failures

Introduce helpers _fixed_by_{kernel,git}_commit() and
_fixed_in_{kernel_,}version() that can be used to hint testers why a
test might be failing and aid in auto-generating of expunge lists for
downstream kernel testing.

A test may be annotated with multiple hints, for example:

_fixed_by_kernel_commit 09889695864 xfs: foo
_fixed_by_kernel_commit 46464565465 ext4: bar
_fixed_in_version xfsprogs v5.15

Annotate fix kernel commits for some overlayfs tests.
Annotate fix kernel version for some overlayfs tests testing
for legacy behavior whose fixes are not likely to be backported
to stable kernels.

This is modeled after LTP's 'make filter-known-fails' and
print_failure_hints() using struct tst_tag annotations.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agocommon: support black listing fs in _supported_fs()
Amir Goldstein [Tue, 19 Apr 2022 12:56:36 +0000 (15:56 +0300)]
common: support black listing fs in _supported_fs()

For example:
_supported_fs ^xfs

There is no need to specify "generic" when using a block list
"all other fs are supported" is implied.

Converted some generic tests that open code this condition without
emitting a meaningful reason.

More generic test like generic/186,187 could use a block list, but
were not converted because they emit some meaningful reason:
  _notrun "Can't fragment free space on btrfs."

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: add some missing _require_loop's v2022.05.01
Josef Bacik [Thu, 28 Apr 2022 15:05:00 +0000 (11:05 -0400)]
fstests: add some missing _require_loop's

Got a new box running overnight fstests and noticed a couple of failures
because I forgot to enable loop device support.  Fix these two tests to
have _require_loop so they don't fail if there's no loop device support.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agogeneric/673: Add separate sgid stripping sub-tests
Yang Xu [Tue, 26 Apr 2022 08:55:45 +0000 (16:55 +0800)]
generic/673: Add separate sgid stripping sub-tests

Even kernel doesn't get ATTR_KILL_SGID mask and get ATTR_KILL_SUID mask,
we still can strip S_ISGID mode in setattr_prepare and setattr_copy.

We should check separate sgid stripping logic whether works well
on different filesystems.

Also fix comments error.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofsstress: remove ALLOCSP and FREESP operations entirely
Zorro Lang [Tue, 26 Apr 2022 06:24:11 +0000 (14:24 +0800)]
fsstress: remove ALLOCSP and FREESP operations entirely

Due to upstream linux has removed ALLOCSP/FREESP ioctls by commit:
4d1b97f9ce7c0 ("xfs: kill the XFS_IOC_{ALLOC,FREE}SP* ioctls"), so
let's remove ALLOCSP/FREESP testing from fsstress, to avoid more
mismatch problems.

Due to g/070 specified "-f allocsp" and "-f freesp=0", so remove
these two lines too.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: btrfs: test setting compression via xattr on nodatacow files
Chung-Chiang Cheng [Mon, 25 Apr 2022 04:22:26 +0000 (12:22 +0800)]
fstests: btrfs: test setting compression via xattr on nodatacow files

Compression and nodatacow are mutually exclusive. Besides ioctl, there
is another way to setting compression via xattrs, and shouldn't produce
invalid combinations.

Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agofstests: remove xfs/144
Eric Sandeen [Tue, 26 Apr 2022 05:14:53 +0000 (00:14 -0500)]
fstests: remove xfs/144

This test was designed to validate the quota warning limit, which in
theory was supposed to migrate from a soft quota to hard enforcement
after a certain number of warnings. However, the xfs kernel commit
which incremented the warning counter was reverted; see:

xfs: revert "xfs: actually bump warning counts when we send warnings"

in the kernel tree for an explanation of why. Due to that revert,
which removed this functionality, remove this test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agogeneric/681, generic/682: add debugging information to $seqreq.full
Theodore Ts'o [Mon, 25 Apr 2022 21:14:50 +0000 (17:14 -0400)]
generic/681, generic/682: add debugging information to $seqreq.full

These two tests are checking whether a non-privileged user causing a
block allocation while expanding a directory block when over quota
will fail with an EDQUOT error.  There are three reasons why this can
fail.

* Aa test bug, where if the file system is using cluster allocation
  (for example, ext4 bigalloc) the test doesn't add enough directory
  entries to actually force directory grwoth.

* A file system bug, where the file system allocates blocks but for
  some reason isn't charging the space quota correctly (which
  currently seems to be the case in ext4 with fscrypt).

* A file system bug, where the file system is correctly charging the
  space quota to the unprivileged user, but isn't failing the system
  call with EDQUOT.

By adding some additional debugging information about whether
directory has grown or not (in addition to the existing repquota
output) to the the $seqres.full, it makes easier for the file system
developer to disambiguate between these possibilities.  It's cheap to
do this, and it could save developer time when trying to root cause
the failure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
5 months agochown: fix ownership format string
Murphy Zhou [Mon, 25 Apr 2022 08:20:51 +0000 (16:20 +0800)]
chown: fix ownership format string

After coreutils rebasing to 9.1, chown(1) behavior changes:
"
   chown and chroot now warn about usages like "chown root.root f",
   which have the nonstandard and long-obsolete "." separator that
   causes problems on platforms where user names contain ".".
   Applications should use ":" instead of ".".
"

https://lwn.net/Articles/891574/

With this behavior change, old format of ownership string will cause
warning like this:
"
+chown: warning: '.' should be ':': '1000.1000'
+.chown: warning: '.' should be ':': '1100.1100'
+.chown: warning: '.' should be ':': '1200.1200'
+.chown: warning: '.' should be ':': '1300.1300'
+.chown: warning: '.' should be ':': '1400.1400'
"

The new format works fine with old versions of coreutils.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>