Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: add check and repair ability for shrunk device item
Date: Tue, 30 Aug 2022 14:49:41 +0800	[thread overview]
Message-ID: <cover.1661841983.git.wqu@suse.com> (raw)

There is a bug report that, a btrfs with shrunk underlying device will
be rejected by kernel, but btrfs-check will report nothing wrong.

Furthermore for such case, even if there is no dev extent in the shrunk
range, we have no way to fix it.
Kernel will refuse to mount, thus no way to shrink the device using
"btrfs dev resize".

This patch will:

- Add check ability to report such mismatch

- Add rescue ability to reset the total_bytes in dev items
  This can only be done if there is no dev extent in the shrunk range.

- Add a test case for above behavior

Qu Wenruo (3):
  btrfs-progs: check: verify the underlying block device size is valid
  btrfs-progs: fsck-tests: add test case for shrunk device
  btrfs-progs: rescue: allow fix-device-size to shrink device item

 check/main.c                                 |  28 ++++
 check/mode-lowmem.c                          |  22 +++
 kernel-shared/volumes.c                      | 135 +++++++++++++++++--
 tests/fsck-tests/059-shrinked-device/test.sh |  32 +++++
 4 files changed, 208 insertions(+), 9 deletions(-)
 create mode 100755 tests/fsck-tests/059-shrinked-device/test.sh

-- 
2.37.2


             reply	other threads:[~2022-08-30  6:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  6:49 Qu Wenruo [this message]
2022-08-30  6:49 ` [PATCH 1/3] btrfs-progs: check: verify the underlying block device size is valid Qu Wenruo
2022-08-30  6:49 ` [PATCH 2/3] btrfs-progs: fsck-tests: add test case for shrunk device Qu Wenruo
2022-08-30  6:49 ` [PATCH 3/3] btrfs-progs: rescue: allow fix-device-size to shrink device item Qu Wenruo
2022-08-31 14:52 ` [PATCH 0/3] btrfs-progs: add check and repair ability for shrunk " David Sterba

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=cover.1661841983.git.wqu@suse.com \
    --to=wqu@suse.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