linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH v2 0/3] Introduce comprehensive sanity check framework and
Date: Wed, 23 Aug 2017 16:57:55 +0900	[thread overview]
Message-ID: <20170823075759.13982-1-quwenruo.btrfs@gmx.com> (raw)

The patchset introduce a new framework to do more comprehensive (if not
the most) sanity check when reading out a leaf.

The new sanity checker will include:

1) Key order
   Existing code

2) Item boundary
   Existing code with enhanced checker to ensure item pointer doesn't
   overlap with item itself.

3) Key type based sanity checker
   Only EXTENT_DATA and EXTENT_CSUM checker is implemented yet.
   As each checker should go through review and tests, or it can easily
   make a valid btrfs failed to be mounted.
   So only two checkers are implemented as an example.

   Existing checker like INODE_REF checker can be moved to this
   framework easily, and we can centralize all existing checkers, make
   the rest of codes more clean.

Performance wise, it's just iterating a leaf.
And it will only get triggered when reading a leaf, cached leaf will
not go through such checker.
So it won't be a performance breaker.

I tested with the patchset applied on v4.13-rc6 with fstests, no
regression is detected.

Changelog:
v2:
  Use EUCLEAN to replace EIO as error code. (Suggested by Nikolay Borisov)
  Pass the whole key from check_leaf() to reduce btrfs_item_key_to_cpu()
  call. (Suggested by Nikolay Borisov)
  Add EXTENT_CSUM checker

Qu Wenruo (4):
  btrfs: Refactor check_leaf function for later expansion.
  btrfs: Check if item pointer overlap with item itself
  btrfs: Add sanity check for EXTENT_DATA when reading out leaf
  btrfs: Add checker for EXTENT_CSUM

 fs/btrfs/disk-io.c              | 189 +++++++++++++++++++++++++++++++++++-----
 include/uapi/linux/btrfs_tree.h |   1 +
 2 files changed, 167 insertions(+), 23 deletions(-)

-- 
2.14.1


             reply	other threads:[~2017-08-23  7:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  7:57 Qu Wenruo [this message]
2017-08-23  7:57 ` [PATCH v2 1/4] btrfs: Refactor check_leaf function for later expansion Qu Wenruo
2017-08-23  7:57 ` [PATCH v2 2/4] btrfs: Check if item pointer overlap with item itself Qu Wenruo
2017-08-23  7:57 ` [PATCH v2 3/4] btrfs: Add sanity check for EXTENT_DATA when reading out leaf Qu Wenruo
2017-09-25 15:45   ` David Sterba
2017-09-26  0:28     ` Qu Wenruo
2017-09-26  0:46       ` Qu Wenruo
2017-09-26 12:13         ` David Sterba
2017-09-26 12:49           ` Qu Wenruo
2017-09-26 14:42             ` David Sterba
2017-09-26 12:05       ` David Sterba
2017-09-26 12:42         ` Qu Wenruo
2017-08-23  7:57 ` [PATCH v2 4/4] btrfs: Add checker for EXTENT_CSUM Qu Wenruo
2017-08-23 15:19 ` [PATCH v2 0/3] Introduce comprehensive sanity check framework and Nikolay Borisov
2017-09-25 15:17 ` 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=20170823075759.13982-1-quwenruo.btrfs@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.cz \
    --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;
as well as URLs for NNTP newsgroup(s).