Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 0/3] btrfs-progs: image: make restored image file to be properly enlarged
Date: Thu, 29 Apr 2021 21:54:49 +0200	[thread overview]
Message-ID: <20210429195449.GZ7604@twin.jikos.cz> (raw)
In-Reply-To: <20210429090658.245238-1-wqu@suse.com>

On Thu, Apr 29, 2021 at 05:06:55PM +0800, Qu Wenruo wrote:
> Recent kernel will refuse to mount restored image, even the source fs is
> empty:
>  # mkfs.btrfs -f /dev/test/test
>  # btrfs-image /dev/test/test /tmp/dump
>  # btrfs-image -r /tmp/dump ~/test.img
>  # mount ~/test.img /mnt/btrfs
>  mount: /mnt/btrfs: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
>  # dmesg -t | tail -n 7
>  loop0: detected capacity change from 10592 to 0
>  BTRFS info (device loop0): disk space caching is enabled
>  BTRFS info (device loop0): has skinny extents
>  BTRFS info (device loop0): flagging fs with big metadata feature
>  BTRFS error (device loop0): device total_bytes should be at most 5423104 but found 10737418240
>  BTRFS error (device loop0): failed to read chunk tree: -22
>  BTRFS error (device loop0): open_ctree failed
> 
> This is triggered by a recent kernel commit 3a160a933111 ("btrfs: drop never met disk total
> bytes check in verify_one_dev_extent").
> 
> But the root cause is, we didn't enlarge the output file if the source
> image only contains single device.
> 
> This bug won't affect restore to block device, or the destination file
> is already large enough.
> 
> This patchset will fix the problem, and with new test case to detect
> such problem.
> 
> Also remove one dead code exposed during the development.
> 
> Changelog:
> v2:
> - Comments word change
> - Only enlarge the file when the target file is smaller than expected
>   device size
> - Change the prefix of the 1st patch
>   From "btrfs" to "btrfs-progs"
> 
> Qu Wenruo (3):
>   btrfs-progs: image: remove the dead stat() call
>   btrfs-progs: image: enlarge the output file if no tree modification is
>     needed for restore
>   btrfs-progs: misc-tests: add test to ensure the restored image can be
>     mounted

Added to devel, thanks.

      parent reply	other threads:[~2021-04-29 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  9:06 [PATCH v2 0/3] btrfs-progs: image: make restored image file to be properly enlarged Qu Wenruo
2021-04-29  9:06 ` [PATCH v2 1/3] btrfs-progs: image: remove the dead stat() call Qu Wenruo
2021-04-29  9:06 ` [PATCH v2 2/3] btrfs-progs: image: enlarge the output file if no tree modification is needed for restore Qu Wenruo
2021-04-29  9:06 ` [PATCH v2 3/3] btrfs-progs: misc-tests: add test to ensure the restored image can be mounted Qu Wenruo
2021-04-29 19:56   ` David Sterba
2021-04-29 19:54 ` David Sterba [this message]

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=20210429195449.GZ7604@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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