All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] btrfs-progs: make check handle invalid bg items
@ 2021-08-18 21:33 Josef Bacik
  2021-08-18 21:33 ` [PATCH v2 01/12] btrfs-progs: fix running lowmem check tests Josef Bacik
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Josef Bacik @ 2021-08-18 21:33 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

v1->v2:
- Discovered that we also don't check bytes_super in the superblock, add that
  checking and repair ability since it's coupled with the block group used
  repair.
- Discovered that we haven't actually been setting --mode=lowmem for the initial
  image check if we do make test-check-lowmem, we only do it after the repair.
  Fixed this.
- Now that we're properly testing error detection in all of the test cases, I
  found 3 problems with the --mode=lowmem mode, one infinite loop and two places
  we weren't properly propagating the error code up to the user.
- My super repair thing tripped a case where we wouldn't clean up properly for
  unaligned extent records, fixed this as well.
- Add another test image for the corrupted super bytes.
- Realize that you need a special .lowmem_repairable file in order for the
  lowmem repair code to run against images, so did that for both testcases.

--- Original email ---
Hello,

While writing code for extent tree v2 I noticed that I was generating a fs with
an invalid block group ->used value.  However fsck wasn't catching this, because
we don't actuall check the used value of the block group items in normal mode.
lowmem mode does this properly thankfully, so this only needs to be added to the
normal fsck mode.

I've added code to btrfs-corrupt-block to generate the corrupt image I need for
the test case.  Then of course the actual patch to detect and fix the problem.
Thanks,

Josef

Josef Bacik (12):
  btrfs-progs: fix running lowmem check tests
  btrfs-progs: do not infinite loop on corrupt keys with lowmem mode
  btrfs-progs: propagate fs root errors in lowmem mode
  btrfs-progs: propagate extent item errors in lowmem mode
  btrfs-progs: do not double add unaligned extent records
  btrfs-progs: add the ability to corrupt block group items
  btrfs-progs: add the ability to corrupt fields of the super block
  btrfs-progs: make check detect and fix invalid used for block groups
  btrfs-progs: make check detect and fix problems with super_bytes_used
  btrfs-progs: check btrfs_super_used in lowmem check
  btrfs-progs: add a test image with a corrupt block group item
  btrfs-progs: add a test image with an invalid super bytes_used

 btrfs-corrupt-block.c                         | 172 +++++++++++++++++-
 check/common.h                                |   5 +
 check/main.c                                  | 124 ++++++++++++-
 check/mode-lowmem.c                           |  25 ++-
 check/mode-lowmem.h                           |   1 +
 tests/common                                  |   5 +-
 .../.lowmem_repairable                        |   0
 .../default.img.xz                            | Bin 0 -> 1036 bytes
 .../.lowmem_repairable                        |   0
 .../default.img.xz                            | Bin 0 -> 1060 bytes
 10 files changed, 322 insertions(+), 10 deletions(-)
 create mode 100644 tests/fsck-tests/050-invalid-block-group-used/.lowmem_repairable
 create mode 100644 tests/fsck-tests/050-invalid-block-group-used/default.img.xz
 create mode 100644 tests/fsck-tests/051-invalid-super-bytes-used/.lowmem_repairable
 create mode 100644 tests/fsck-tests/051-invalid-super-bytes-used/default.img.xz

-- 
2.26.3


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

end of thread, other threads:[~2021-08-23 23:34 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 21:33 [PATCH v2 00/12] btrfs-progs: make check handle invalid bg items Josef Bacik
2021-08-18 21:33 ` [PATCH v2 01/12] btrfs-progs: fix running lowmem check tests Josef Bacik
2021-08-19  5:40   ` Qu Wenruo
2021-08-23 14:54   ` David Sterba
2021-08-18 21:33 ` [PATCH v2 02/12] btrfs-progs: do not infinite loop on corrupt keys with lowmem mode Josef Bacik
2021-08-19  5:42   ` Qu Wenruo
2021-08-23 15:04     ` David Sterba
2021-08-23 18:44       ` Josef Bacik
2021-08-23 23:34         ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 03/12] btrfs-progs: propagate fs root errors in " Josef Bacik
2021-08-19  5:43   ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 04/12] btrfs-progs: propagate extent item " Josef Bacik
2021-08-19  5:45   ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 05/12] btrfs-progs: do not double add unaligned extent records Josef Bacik
2021-08-18 21:33 ` [PATCH v2 06/12] btrfs-progs: add the ability to corrupt block group items Josef Bacik
2021-08-18 21:33 ` [PATCH v2 07/12] btrfs-progs: add the ability to corrupt fields of the super block Josef Bacik
2021-08-23 14:59   ` David Sterba
2021-08-18 21:33 ` [PATCH v2 08/12] btrfs-progs: make check detect and fix invalid used for block groups Josef Bacik
2021-08-19  5:54   ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 09/12] btrfs-progs: make check detect and fix problems with super_bytes_used Josef Bacik
2021-08-19  5:56   ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 10/12] btrfs-progs: check btrfs_super_used in lowmem check Josef Bacik
2021-08-19  5:57   ` Qu Wenruo
2021-08-18 21:33 ` [PATCH v2 11/12] btrfs-progs: add a test image with a corrupt block group item Josef Bacik
2021-08-18 21:33 ` [PATCH v2 12/12] btrfs-progs: add a test image with an invalid super bytes_used Josef Bacik
2021-08-23 18:31 ` [PATCH v2 00/12] btrfs-progs: make check handle invalid bg items David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.