From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <fdmanana@gmail.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] btrfs-progs: Add support for btrfs-image + corrupt script fsck test case.
Date: Mon, 15 Dec 2014 17:40:02 +0800 [thread overview]
Message-ID: <548EAC72.9030006@cn.fujitsu.com> (raw)
In-Reply-To: <CAL3q7H4S6UDMwZb5oX0c=cpa4=ryDdJLwRE7me5aBBVY9ercvg@mail.gmail.com>
-------- Original Message --------
Subject: Re: [PATCH 1/2] btrfs-progs: Add support for btrfs-image +
corrupt script fsck test case.
From: Filipe David Manana <fdmanana@gmail.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: 2014年12月15日 17:00
> On Mon, Dec 15, 2014 at 3:54 AM, Qu Wenruo <quwenruo@cn.fujitsu.com> wrote:
>> Although btrfsck test case support pure image dump(tar.xz), it is still
>> too large for some images, e.g, a small 64M image with about 3 levels
>> (level 0~2) metadata will produce about 2.6M after xz zip, which is too
>> large for a single binary commit.
>>
>> However btrfs-image -c9 will works much finer, the above image with
>> btrfs-image dump will only be less than 200K, which is quite reasonable.
>>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>> ---
>> tests/fsck-tests.sh | 34 ++++++++++++++++++++++++++++++++--
>> 1 file changed, 32 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/fsck-tests.sh b/tests/fsck-tests.sh
>> index 8987d04..007e5b0 100644
>> --- a/tests/fsck-tests.sh
>> +++ b/tests/fsck-tests.sh
>> @@ -22,16 +22,38 @@ run_check()
>> "$@" >> $RESULT 2>&1 || _fail "failed: $@"
>> }
>>
>> +# For complicated fsck repair case,
>> +# where even repairing is OK, it may still report problem before or after
>> +# reparing since the repair needs several loops to repair all the problems
>> +# but report checks it before all repair loops done
>> +run_check_no_fail()
>> +{
>> + echo "############### $@" >> $RESULT 2>&1
>> + "$@" >> $RESULT 2>&1
>> +}
> I'm confused with this function, why it's needed and the respective comment.
> So I can interpret it as either:
>
> 1) The several loops means fsck --repair does multiple passages
> internally to fix some issues?
> If this is the case, we (user or script) only need to call fsck
> --repair once, which should exit with status 0 if it was able to fix
> all the issues, right? If so, then we should check that fsck --repair
> exits with status 0, removing the need for this new function.
Sorry for the poor explain.
The problem is, there is some check cases before we doing repair and
these check result is bad so
btrfsck thinks there is err even it will be repaired later.
So The result is, especially on corrupted-leaf case, btrfsck --repair
will fix all the problems but
still return 1, and the next btrfsck without --repair will return 0.
I think there are still a lot of other cases causing things like
this(multiple different errors combines together)
so just discard the return value of btrfsck --repair and focus on the
second btrfsck return value.
Thanks,
Qu
>
> 2) The several loops means a user or script must call fsck --repair
> multiple times to fix all the issues? If this is the case then you're
> only calling this function once, for a single fsck --repair, in the
> code below, which confuses me and it makes this new function redundant
> too.
>
> Thanks
>
>> +
>> rm -f $RESULT
>>
>> # test rely on corrupting blocks tool
>> run_check make btrfs-corrupt-block
>>
>> +# Supported test image formats:
>> +# 1) btrfs-image dump(.img files)
>> # Some broken filesystem images are kept as .img files, created by the tool
>> -# btrfs-image, and others are kept as .tar.xz files that contain raw filesystem
>> +# btrfs-image
>> +#
>> +# 2) binary image dump only(only test.img in .tar.xz)
>> +# Some are kept as .tar.xz files that contain raw filesystem
>> # image (the backing file of a loop device, as a sparse file). The reason for
>> # keeping some as tarballs of raw images is that for these cases btrfs-image
>> # isn't able to preserve all the (bad) filesystem structure for some reason.
>> +# This provides great flexibility at the cost of large file size.
>> +#
>> +# 3) script generated dump(generate_image.sh + needed things in .tar.gz)
>> +# The image is generated by the generate_image.sh script alone the needed
>> +# files in the tarball, normally a quite small btrfs-image dump.
>> +# This one combines the advatange of relative small btrfs-image and the
>> +# flexibility to support corrupted image.
>> for i in $(find $here/tests/fsck-tests -name '*.img' -o -name '*.tar.xz' | sort)
>> do
>> echo " [TEST] $(basename $i)"
>> @@ -39,16 +61,24 @@ do
>>
>> extension=${i#*.}
>>
>> + if [ -f generate_image.sh ]; then
>> + rm generate_image.sh
>> + fi
>> +
>> if [ $extension == "img" ]; then
>> run_check $here/btrfs-image -r $i test.img
>> else
>> run_check tar xJf $i
>> fi
>>
>> + if [ -x generate_image.sh ]; then
>> + ./generate_image.sh
>> + fi
>> +
>> $here/btrfsck test.img >> $RESULT 2>&1
>> [ $? -eq 0 ] && _fail "btrfsck should have detected corruption"
>>
>> - run_check $here/btrfsck --repair test.img
>> + run_check_no_fail $here/btrfsck --repair test.img
>> run_check $here/btrfsck test.img
>> done
>>
>> --
>> 2.1.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2014-12-15 9:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 3:54 [PATCH 1/2] btrfs-progs: Add support for btrfs-image + corrupt script fsck test case Qu Wenruo
2014-12-15 6:09 ` Qu Wenruo
2014-12-18 17:16 ` David Sterba
2014-12-15 9:00 ` Filipe David Manana
2014-12-15 9:40 ` Qu Wenruo [this message]
2014-12-15 9:43 ` Filipe David Manana
2014-12-16 1:00 ` Qu Wenruo
2014-12-15 9:36 ` Filipe David Manana
2014-12-15 10:13 ` Filipe David Manana
2014-12-15 18:19 ` David Sterba
2014-12-16 1:35 ` Qu Wenruo
2014-12-16 14:08 ` Filipe David Manana
2014-12-24 0:03 ` Dave Chinner
2014-12-24 2:56 ` Qu Wenruo
2014-12-24 3:27 ` Dave Chinner
2014-12-15 17:35 ` David Sterba
2014-12-16 0:58 ` Qu Wenruo
2014-12-16 13:55 ` Filipe David Manana
2014-12-17 0:49 ` Qu Wenruo
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=548EAC72.9030006@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=fdmanana@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).