Re: [PATCH 0/7] Corrupt counter improvement

David Sterba
2020-07-03T15:32:22Z

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.