linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, jthumshirn@suse.de
Subject: Re: [PATCH Fix-title-prefix] btrfs-progs: misc-tests-021 fix restore overlapped on disk's stale data
Date: Wed, 4 Sep 2019 17:06:02 +0300	[thread overview]
Message-ID: <86a5df7f-851f-0760-6247-330c4e156f7e@suse.com> (raw)
In-Reply-To: <20190904132947.1232-1-anand.jain@oracle.com>



On 4.09.19 г. 16:29 ч., Anand Jain wrote:
> As misc-tests/021 image dump is restored on the same original loop
> device, this overlaps with the stale data and makes the test pass
> falsely.
> 
> Fix this by using a new device for restore.
> 
> And also, the btrfs-image dump and restore doesn't not collect the data,
> so any read on the files should be avoided. So instead of file data use
> file stat data for the md5sum.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> Reported-by: Johannes Thumshirn <jthumshirn@suse.de>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  tests/misc-tests/021-image-multi-devices/test.sh | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/misc-tests/021-image-multi-devices/test.sh b/tests/misc-tests/021-image-multi-devices/test.sh
> index b1013b5d2596..5ed8f4b01457 100755
> --- a/tests/misc-tests/021-image-multi-devices/test.sh
> +++ b/tests/misc-tests/021-image-multi-devices/test.sh
> @@ -10,17 +10,18 @@ check_prereq btrfs
>  
>  setup_root_helper
>  
> -setup_loopdevs 2
> +setup_loopdevs 3
>  prepare_loopdevs
>  loop1=${loopdevs[1]}
>  loop2=${loopdevs[2]}
> +loop3=${loopdevs[3]}
>  
>  # Create the test file system.
>  
>  run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$loop1" "$loop2"
>  run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT"
>  run_check $SUDO_HELPER dd bs=1M count=1 if=/dev/zero of="$TEST_MNT/foobar"
> -orig_md5=$(run_check_stdout md5sum "$TEST_MNT/foobar" | cut -d ' ' -f 1)
> +orig_md5=$(run_check_stdout stat "$TEST_MNT/foobar" | md5sum | cut -d ' ' -f 1)
>  run_check $SUDO_HELPER umount "$TEST_MNT"
>  
>  # Create the image to restore later.
> @@ -32,13 +33,13 @@ run_check $SUDO_HELPER "$TOP/btrfs-image" "$loop1" "$IMAGE"
>  run_check $SUDO_HELPER wipefs -a "$loop1"
>  run_check $SUDO_HELPER wipefs -a "$loop2"
>  
> -run_check $SUDO_HELPER "$TOP/btrfs-image" -r "$IMAGE" "$loop1"
> +run_check $SUDO_HELPER "$TOP/btrfs-image" -r "$IMAGE" "$loop3"
>  
>  # Run check to make sure there is nothing wrong for the recovered image
> -run_check $SUDO_HELPER "$TOP/btrfs" check "$loop1"
> +run_check $SUDO_HELPER "$TOP/btrfs" check "$loop3"
>  
> -run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT"
> -new_md5=$(run_check_stdout md5sum "$TEST_MNT/foobar" | cut -d ' ' -f 1)
> +run_check $SUDO_HELPER mount "$loop3" "$TEST_MNT"
> +new_md5=$(run_check_stdout stat "$TEST_MNT/foobar" | md5sum | cut -d ' ' -f 1)
>  run_check $SUDO_HELPER umount "$TEST_MNT"
>  
>  cleanup_loopdevs
> 

  parent reply	other threads:[~2019-09-04 14:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  2:26 [PATCH] btrfs_progs: mkfs: match devid order to the stripe index Anand Jain
2019-06-28  2:44 ` Qu Wenruo
2019-06-28  3:28   ` Anand Jain
2019-06-28  6:01     ` Qu Wenruo
2019-07-03 13:21 ` David Sterba
2019-08-27  2:02   ` Anand Jain
2019-09-02  8:01     ` Anand Jain
2019-09-02 16:22       ` David Sterba
2019-09-03 12:06         ` David Sterba
2019-09-04 11:10           ` Anand Jain
2019-09-12 17:54           ` David Sterba
2019-12-10 15:42             ` Filipe Manana
2019-12-11  1:45               ` Qu Wenruo
2019-12-11  8:58                 ` Filipe Manana
2019-09-03 10:46 ` Johannes Thumshirn
2019-09-04 12:54   ` [PATCH] btrfs: misc-tests-021 fix restore overlapped on disk's stale data Anand Jain
2019-09-04 13:29   ` [PATCH Fix-title-prefix] btrfs-progs: " Anand Jain
2019-09-04 14:05     ` Johannes Thumshirn
2019-09-04 14:06     ` Nikolay Borisov [this message]
2019-09-10  7:43     ` Anand Jain
2019-09-12 17:49     ` David Sterba
2019-09-10  7:37 ` [PATCH] btrfs_progs: mkfs: match devid order to the stripe index 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=86a5df7f-851f-0760-6247-330c4e156f7e@suse.com \
    --to=nborisov@suse.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=jthumshirn@suse.de \
    --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).