mbox series

[0/7] Corrupt counter improvement

Message ID 20200702122335.9117-1-nborisov@suse.com (mailing list archive)
Headers show
Series Corrupt counter improvement | expand

Message

Nikolay Borisov July 2, 2020, 12:23 p.m. UTC
This series aims to make the device corrupt counter be incremented when we
encounter checksum error. This stems from an upstream report at [0] that btrfs
doesn't actually increment the corruption device stats counter. There's no good
reason why this should be the case so here's a patchset rectifying this.

While looking around the code I thought the signature of the functions related
to creating the failrec are somewhat quirky so the first 2 patches fix this.

Patch 3 introduces btrfs_device into btrfs_io_bio so that functions in the
bio completion stack can use it.

Patch 4 removes a redundant check

Next 3 patches wire in increment of the CORRUPT counter in the respective
read end io routines, namely compressed and ordinary reads.

Last patch creates a symlink of the private bdi that btrfs creates on mount
which is used in an xfstest for this series.

[0] https://lore.kernel.org/linux-btrfs/4857863.FCrPRfMyHP@liv/

Nikolay Borisov (8):
  btrfs: Make get_state_failrec return failrec directly
  btrfs: Streamline btrfs_get_io_failure_record logic
  btrfs: Record btrfs_device directly btrfs_io_bio
  btrfs: Don't check for btrfs_device::bdev in btrfs_end_bio
  btrfs: Increment device corruption error in case of checksum error
  btrfs: Remove needless ASSERT
  btrfs: Increment corrupt device counter during compressed read
  btrfs: sysfs: Add bdi link to the fsid dir

 fs/btrfs/compression.c    |  10 ++-
 fs/btrfs/ctree.h          |   2 +
 fs/btrfs/extent-io-tree.h |   6 +-
 fs/btrfs/extent_io.c      | 152 +++++++++++++++++++-------------------
 fs/btrfs/inode.c          |   3 +
 fs/btrfs/raid56.c         |   1 +
 fs/btrfs/sysfs.c          |  16 +++-
 fs/btrfs/volumes.c        |  24 +++---
 fs/btrfs/volumes.h        |   2 +-
 9 files changed, 114 insertions(+), 102 deletions(-)

--
2.17.1

Comments

David Sterba July 3, 2020, 3:32 p.m. UTC | #1
On Thu, Jul 02, 2020 at 03:23:27PM +0300, Nikolay Borisov wrote:
> This series aims to make the device corrupt counter be incremented when we
> encounter checksum error. This stems from an upstream report at [0] that btrfs
> doesn't actually increment the corruption device stats counter. There's no good
> reason why this should be the case so here's a patchset rectifying this.

Yeah I think this was forgotten at the time the dev-stats were merged.

> While looking around the code I thought the signature of the functions related
> to creating the failrec are somewhat quirky so the first 2 patches fix this.
> 
> Patch 3 introduces btrfs_device into btrfs_io_bio so that functions in the
> bio completion stack can use it.
> 
> Patch 4 removes a redundant check
> 
> Next 3 patches wire in increment of the CORRUPT counter in the respective
> read end io routines, namely compressed and ordinary reads.
> 
> Last patch creates a symlink of the private bdi that btrfs creates on mount
> which is used in an xfstest for this series.
> 
> [0] https://lore.kernel.org/linux-btrfs/4857863.FCrPRfMyHP@liv/
> 
> Nikolay Borisov (8):
>   btrfs: Make get_state_failrec return failrec directly
>   btrfs: Streamline btrfs_get_io_failure_record logic
>   btrfs: Record btrfs_device directly btrfs_io_bio
>   btrfs: Don't check for btrfs_device::bdev in btrfs_end_bio
>   btrfs: Increment device corruption error in case of checksum error
>   btrfs: Remove needless ASSERT
>   btrfs: Increment corrupt device counter during compressed read
>   btrfs: sysfs: Add bdi link to the fsid dir

This is pretty straightforward, thanks. I did some smallish changes like
renaming the btrfs_io_bio::dev to device.

Updating the existing counter is in line with scrub so we don't have to
change the on-disk stats.

Patchset is now in misc-next, I don't see any reason to keep it in a
topic branch.