All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH v3 0/9] btrfs-progs: make check handle invalid bg items
Date: Mon, 23 Aug 2021 15:23:04 -0400	[thread overview]
Message-ID: <cover.1629746415.git.josef@toxicpanda.com> (raw)

v2->v3:
- Rebased onto devel.
- Fixed the lowmem checks to work with Qu's test for subpage.
- Adjust the titles to indicate the area where the patch is for.
- Make btrfs_next_leaf() return an error instead of doing check_block in lowmem.
- Drop the corrupt-block patche for super blocks.

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 (9):
  btrfs-progs: tests: fix running lowmem checks
  btrfs-progs: check blocks in btrfs_next_sibling_block
  btrfs-progs: check: propagate fs root errors in lowmem mode
  btrfs-progs: check: propagate extent item errors in lowmem mode
  btrfs-progs: do not double add unaligned extent records
  btrfs-progs: check: detect and fix problems with super_bytes_used
  btrfs-progs: check: detect issues with btrfs_super_used in lowmem
    check
  btrfs-progs: test: add a test image with a corrupt block group item
  btrfs-progs: tests: add a test image with an invalid super bytes_used

 check/main.c                                  |  35 ++++++++++++++++++
 check/mode-lowmem.c                           |  16 +++++++-
 check/mode-lowmem.h                           |   1 +
 kernel-shared/ctree.c                         |   7 ++++
 tests/common                                  |   6 +--
 .../.lowmem_repairable                        |   0
 .../.lowmem_repairable                        |   0
 .../default.img.xz                            | Bin 0 -> 1060 bytes
 8 files changed, 59 insertions(+), 6 deletions(-)
 create mode 100644 tests/fsck-tests/050-invalid-block-group-used/.lowmem_repairable
 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


             reply	other threads:[~2021-08-23 19:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 19:23 Josef Bacik [this message]
2021-08-23 19:23 ` [PATCH v3 1/9] btrfs-progs: tests: fix running lowmem checks Josef Bacik
2021-08-23 19:23 ` [PATCH v3 2/9] btrfs-progs: check blocks in btrfs_next_sibling_block Josef Bacik
2021-08-24 16:48   ` David Sterba
2021-08-23 19:23 ` [PATCH v3 3/9] btrfs-progs: check: propagate fs root errors in lowmem mode Josef Bacik
2021-08-23 19:23 ` [PATCH v3 4/9] btrfs-progs: check: propagate extent item " Josef Bacik
2021-08-23 19:23 ` [PATCH v3 5/9] btrfs-progs: do not double add unaligned extent records Josef Bacik
2021-08-23 19:23 ` [PATCH v3 6/9] btrfs-progs: check: detect and fix problems with super_bytes_used Josef Bacik
2021-08-23 19:23 ` [PATCH v3 7/9] btrfs-progs: check: detect issues with btrfs_super_used in lowmem check Josef Bacik
2021-08-23 19:23 ` [PATCH v3 8/9] btrfs-progs: test: add a test image with a corrupt block group item Josef Bacik
2021-08-24 17:00   ` David Sterba
2021-08-25 13:27     ` David Sterba
2021-08-23 19:23 ` [PATCH v3 9/9] btrfs-progs: tests: add a test image with an invalid super bytes_used Josef Bacik

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.1629746415.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.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 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.