]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commit
fstests: btrfs/121: allow snapshot with invalid qgroup to return error
authorQu Wenruo <wqu@suse.com>
Sun, 3 Mar 2024 06:52:51 +0000 (17:22 +1030)
committerZorro Lang <zlang@kernel.org>
Tue, 12 Mar 2024 03:39:52 +0000 (11:39 +0800)
commit8000febb32af1cdc5ebf158861455b1688d7e8ef
treee25955bc7953f80069274886b5f57e066b283355
parentd76c4886ba830edb17a9b2c377e5cce098edcf42
fstests: btrfs/121: allow snapshot with invalid qgroup to return error

[BUG]
After incoming kernel commit "btrfs: qgroup: verify btrfs_qgroup_inherit
parameter", test case btrfs/121 would fail like this:

btrfs/121 1s ... [failed, exit status 1]- output mismatch (see /xfstests/results//btrfs/121.out.bad)
    --- tests/btrfs/121.out 2022-05-11 09:55:30.739999997 +0800
    +++ /xfstests/results//btrfs/121.out.bad 2024-03-03 13:33:38.076666665 +0800
    @@ -1,2 +1,3 @@
     QA output created by 121
    -Silence is golden
    +failed: '/usr/bin/btrfs subvolume snapshot -i 1/10 /mnt/scratch /mnt/scratch/snap1'
    +(see /xfstests/results//btrfs/121.full for details)
    ...
    (Run 'diff -u /xfstests/tests/btrfs/121.out /xfstests/results//btrfs/121.out.bad'  to see the entire diff)

[CAUSE]
The incoming kernel commit would do early qgroups validation before
subvolume/snapshot creation, and reject invalid qgroups immediately.

Meanwhile that test case itself still assume the ioctl would go on
without any error, thus the new behavior would break the test case.

[FIX]
Instead of relying on the snapshot creation ioctl return value, we just
completely ignore the output of that snapshot creation.
Then manually check if the fs is still read-write.

For different kernels (3 cases), they would lead to the following
results:

- Older unpatched kernel
  The filesystem would trigger a transaction abort (would be caught by
  dmesg filter), and also fail the "touch" command.

- Older but patched kernel
  The filesystem continues to create the snapshot, while still keeps the
  fs read-write.

- Latest kernel with qgroup validation
  The filesystem refuses to create the snapshot, while still keeps the
  fs read-write.

Both "older but patched" and "latest" kernels would still pass the test
case, even with different behaviors.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/121