Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs-progs: add check and repair ability for shrunk device item
@ 2022-08-30  6:49 Qu Wenruo
  2022-08-30  6:49 ` [PATCH 1/3] btrfs-progs: check: verify the underlying block device size is valid Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Qu Wenruo @ 2022-08-30  6:49 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-31 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30  6:49 [PATCH 0/3] btrfs-progs: add check and repair ability for shrunk device item Qu Wenruo
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox