From: Eryu Guan <guan@eryu.me>
To: ethanwu <ethanwu@synology.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, fdmanana@gmail.com
Subject: Re: [PATCH] btrfs: test if rename handles dir item collision correctly
Date: Sun, 29 Nov 2020 15:19:04 +0800 [thread overview]
Message-ID: <20201129071904.GO3853@desktop> (raw)
In-Reply-To: <20201126105013.246270-1-ethanwu@synology.com>
On Thu, Nov 26, 2020 at 06:50:13PM +0800, ethanwu wrote:
> This is a regression test for the issue fixed by the kernel commit titled
> "Btrfs: correctly calculate item size used when item key collision happends"
>
> In this case, we'll simply rename many forged filename that cause collision
> under a directory to see if rename failed and filesystem is forced readonly.
>
> Signed-off-by: ethanwu <ethanwu@synology.com>
> ---
> tests/btrfs/227 | 311 ++++++++++++++++++++++++++++++++++++++++++++
> tests/btrfs/227.out | 2 +
> tests/btrfs/group | 1 +
> 3 files changed, 314 insertions(+)
> create mode 100755 tests/btrfs/227
> create mode 100644 tests/btrfs/227.out
>
> diff --git a/tests/btrfs/227 b/tests/btrfs/227
> new file mode 100755
> index 00000000..ba1cd359
> --- /dev/null
> +++ b/tests/btrfs/227
> @@ -0,0 +1,311 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2020 Synology. All Rights Reserved.
> +#
> +# FS QA Test 227
> +#
> +# Test if btrfs rename handle dir item collision correctly
> +# Without patch fix, rename will fail with EOVERFLOW, and filesystem
> +# is forced readonly.
> +#
> +# This bug is going to be fxied by a patch for kernel titled
> +# "Btrfs: correctly calculate item size used when item key collision happends"
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +_supported_fs btrfs
> +_require_scratch
> +
> +rm -f $seqres.full
> +
> +# Currently in btrfs the node/leaf size can not be smaller than the page
> +# size (but it can be greater than the page size). So use the largest
> +# supported node/leaf size (64Kb) so that the test can run on any platform
> +# that Linux supports.
> +_scratch_mkfs "--nodesize 65536" >>$seqres.full 2>&1
> +_scratch_mount
> +
> +file_name_list=(d6d0dIka505ebc681949a25a3f1a4e7464f18bfcdb04a103b8ece40cddf61ccc9e690232878008edceecda8633591197bce8c0105891d2717425cb4bd04223bb08426de820da732c0e16b8a9fa236bb5b5260e526639780dacd378ca79428f640a0300a11a98f4f92719c62d6f7d756fa80f0aa654ae06
The file names are too long for the test, I'm wondering how are the
names that could cause collisions generated in the first place? Is it
possible to re-generate them at runtime? Instead of hard-coding them in
the array.
Thanks,
Eryu
next prev parent reply other threads:[~2020-11-29 7:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 10:50 [PATCH] btrfs: test if rename handles dir item collision correctly ethanwu
2020-11-27 10:24 ` Filipe Manana
2020-11-29 7:19 ` Eryu Guan [this message]
2020-12-01 6:59 ` tzuchieh wu
2020-12-02 10:47 ` Filipe Manana
2020-12-02 16:21 ` Eryu Guan
2020-12-03 14:12 ` Filipe Manana
2020-12-07 10:19 ` tzuchieh wu
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=20201129071904.GO3853@desktop \
--to=guan@eryu.me \
--cc=ethanwu@synology.com \
--cc=fdmanana@gmail.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