FS/XFS testing framework
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] btrfs/321: make the test work when compression is enabled
Date: Fri, 13 Sep 2024 07:05:30 +0930	[thread overview]
Message-ID: <992b0055-12a2-47e8-91e2-38fb763cac9e@gmx.com> (raw)
In-Reply-To: <21f8d987309ca0699c6bb95666278d02da03ff32.1726145029.git.fdmanana@suse.com>



在 2024/9/12 22:15, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> When running btrfs/321 with compression enabled it fails like this:
>
>    $ MOUNT_OPTIONS="-o compress" ./check btrfs/321
>    FSTYP         -- btrfs
>    PLATFORM      -- Linux/x86_64 debian0 6.11.0-rc7-btrfs-next-174+ #1 SMP PREEMPT_DYNAMIC Tue Sep 10 17:11:38 WEST 2024
>    MKFS_OPTIONS  -- /dev/sdc
>    MOUNT_OPTIONS -- -o compress /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
>
>    btrfs/321 2s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad)
>        --- tests/btrfs/321.out	2024-09-12 12:12:11.259272125 +0100
>        +++ /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad	2024-09-12 13:18:40.231120012 +0100
>        @@ -1,2 +1,5 @@
>         QA output created by 321
>        -Silence is golden
>        +mount: /home/fdmanana/btrfs-tests/scratch_1: can't read superblock on /dev/sdc.
>        +       dmesg(1) may have more information after failed mount system call.
>        +mount -o compress -o ro /dev/sdc /home/fdmanana/btrfs-tests/scratch_1 failed
>        +(see /home/fdmanana/git/hub/xfstests/results//btrfs/321.full for details)
>        ...
>        (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/321.out /home/fdmanana/git/hub/xfstests/results//btrfs/321.out.bad'  to see the entire diff)
>
>    HINT: You _MAY_ be missing kernel fix:
>          10d9d8c3512f btrfs: fix a use-after-free bug when hitting errors inside btrfs_submit_chunk()
>
>    Ran: btrfs/321
>    Failures: btrfs/321
>    Failed 1 of 1 tests
>
> This is because with compression enabled we get a csum tree that has only
> one leaf, and that leaf is the root of the csum tree. That means that
> after the test corrupts the leaf, the next mount will fail since an error
> loading the root is critical and makes the mount operation fail.
>
> Fix this by creating a file with 128M of data instead of 32M, as this
> guarantees that even if compression is enabled, and even with the maximum
> allowed leaf size (64K), we still get a csum tree with multiple leaves,
> making the test work.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

My bad, I forgot compression, which will reduce the csum size.

Thanks,
Qu
> ---
>   tests/btrfs/321 | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tests/btrfs/321 b/tests/btrfs/321
> index 93935530..c13ccc1e 100755
> --- a/tests/btrfs/321
> +++ b/tests/btrfs/321
> @@ -33,9 +33,11 @@ _scratch_pool_mkfs "-d raid0 -m single -n 4k -s 4k" >> $seqres.full 2>&1
>   # This test requires data checksum to trigger the bug.
>   _scratch_mount -o datasum,datacow
>
> -# For the smallest csum size (CRC32C) it's 4 bytes per 4K, writing 32M data
> -# will need 32K data checksum at minimal, which is at least 8 leaves.
> -_pwrite_byte 0xef 0 32m "$SCRATCH_MNT/foobar" > /dev/null
> +# For the smallest csum size (CRC32C) it's 4 bytes per 4K, writing 128M of data
> +# will need 128K data checksum at minimal, which is at least 34 leaves when
> +# running without compression and a leaf size of 64K. With compression enabled
> +# and a 64K leaf size, it will be 2 leaves.
> +_pwrite_byte 0xef 0 128m "$SCRATCH_MNT/foobar" > /dev/null
>   _scratch_unmount
>
>

  reply	other threads:[~2024-09-12 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 12:45 [PATCH] btrfs/321: make the test work when compression is enabled fdmanana
2024-09-12 21:35 ` Qu Wenruo [this message]
2024-09-20 10:58 ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=992b0055-12a2-47e8-91e2-38fb763cac9e@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox