public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: add parent-child ownership check
@ 2022-02-22  7:41 Qu Wenruo
  2022-02-22  7:41 ` [PATCH 1/3] btrfs: unify the error handling pattern for read_tree_block() Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Qu Wenruo @ 2022-02-22  7:41 UTC (permalink / raw)
  To: linux-btrfs

Tree-checker doesn't really check owner except for empty leaf.

This allows parent-child ownership mismatch to sneak in.

Enhance the checks again tree block owner by:

- Add owner check when reading child tree blocks

- Make sure the tree root owner matches the root key

Unfortunately the check still has some cases missing, mostly for

- Log/reloc trees
  Need full root key to check, which is not really possible for
  some backref call sites.


The first 2 patches are just cleanup to unify the error handling
patterns, there are some "creative" way checking the errors, which is
not really reader friendly.

The last patch is doing the real work.

Qu Wenruo (3):
  btrfs: unify the error handling pattern for read_tree_block()
  btrfs: unify the error handling of btrfs_read_buffer()
  btrfs: check extent buffer owner against the owner rootid

 fs/btrfs/backref.c      |  7 +++--
 fs/btrfs/ctree.c        | 48 +++++++++++++++++++---------------
 fs/btrfs/disk-io.c      | 37 +++++++++++++++++++++-----
 fs/btrfs/print-tree.c   |  4 +--
 fs/btrfs/relocation.c   |  3 ++-
 fs/btrfs/tree-checker.c | 57 +++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/tree-checker.h |  1 +
 7 files changed, 125 insertions(+), 32 deletions(-)

-- 
2.35.1


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

end of thread, other threads:[~2022-03-04 23:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22  7:41 [PATCH 0/3] btrfs: add parent-child ownership check Qu Wenruo
2022-02-22  7:41 ` [PATCH 1/3] btrfs: unify the error handling pattern for read_tree_block() Qu Wenruo
2022-02-22  7:41 ` [PATCH 2/3] btrfs: unify the error handling of btrfs_read_buffer() Qu Wenruo
2022-02-22  7:41 ` [PATCH 3/3] btrfs: check extent buffer owner against the owner rootid Qu Wenruo
2022-03-04 16:25   ` Filipe Manana
2022-03-04 23:11     ` Qu Wenruo
2022-03-01 21:45 ` [PATCH 0/3] btrfs: add parent-child ownership check David Sterba

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