Skip to content

Fix error handling on data bio submission

Josef Bacik linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 5 repliesIn review
  2. v18 patches 11 repliesSuperseded

Changes in v2 from the cover letter

- addressed the various comments, expanded on the comment about NODATASUM and the DATA_RELOC inode since I had to look up why we even had that there.
- Added the various reviewed-by's on the patches I didn't touch.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8btrfs: make search_csum_tree return 0 if we get -EFBIGfs/btrfs/file-item.c+1 -10 replies
2/8btrfs: handle csum lookup errors properly on readsfs/btrfs/file-item.c+27 -143 replies
3/8btrfs: check correct bio in finish_compressed_bio_readfs/btrfs/compression.c+1 -10 replies
4/8btrfs: remove the bio argument from finish_compressed_bio_readfs/btrfs/compression.c+3 -50 replies
5/8btrfs: track compressed bio errors as blk_status_tfs/btrfs/compression.c fs/btrfs/compression.h+16 -140 replies
6/8btrfs: do not double complete bio on errors during compressed readsfs/btrfs/compression.c fs/btrfs/inode.c+22 -101 reply
7/8btrfs: do not try to repair bio that has no mirror setfs/btrfs/extent_io.c+9 -00 replies
8/8btrfs: do not clean up repair bio if submit failsfs/btrfs/extent_io.c+8 -80 replies

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchBoris BurkovJohannes Thumshirn
1/8R-b R-b
2/8
3/8R-b R-b
4/8R-b
5/8
6/8
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] Fix error handling on data bio submission

v1->v2:
- addressed the various comments, expanded on the comment about NODATASUM and the DATA_RELOC inode since I had to look up why we even had that there.
- Added the various reviewed-by's on the patches I didn't touch.

--- Original email ---

Internally we tried to enable a remediation to automatically re-provision machines that had checksum errors. This was based on dmesg scanning, however we discovered that we were getting transienty csum error messages. This came down to getting a transient ENOMEM while trying to lookup checksums while doing a data read (this was on memory constrained containers).

What we were doing was simply acting like there wasn't a checksum there, which would print a scary message about missing checksums. And then we'd do the read, but because we didn't have a checksum we'd complain about a checksum mismatch. Neither of these things were actually what was happening, we simply got an EIO while looking up the checksums.

Fix this by properly returning an error and erroring out the BIO with the correct error. This is actually correct, it allows us to skip the IO and also not erroneously tell the user that their checksums are invalid.

While testing this fix however I uncovered a variety of problems with our error handling when we submit. So the first two patches are to fix the main problem I wanted to fix, and the next 6 are to fix problems that happen when injecting errors into the checksum lookup path.

With these patches I'm no longer getting csum mismatch errors when I fail to lookup csums, and I'm also able to survive a xfstests run while randomly injecting errors into this path. Thanks,

Josef

Josef Bacik (8):
btrfs: make search_csum_tree return 0 if we get -EFBIG
btrfs: handle csum lookup errors properly on reads
btrfs: check correct bio in finish_compressed_bio_read
btrfs: remove the bio argument from finish_compressed_bio_read
btrfs: track compressed bio errors as blk_status_t
btrfs: do not double complete bio on errors during compressed reads
btrfs: do not try to repair bio that has no mirror set
btrfs: do not clean up repair bio if submit fails

 fs/btrfs/compression.c | 58 ++++++++++++++++++++++++------------------
 fs/btrfs/compression.h |  2 +-
 fs/btrfs/extent_io.c   | 25 ++++++++++++------
 fs/btrfs/file-item.c   | 43 ++++++++++++++++++++-----------
 fs/btrfs/inode.c       | 12 ++++++---
 5 files changed, 87 insertions(+), 53 deletions(-)
Signature · 1 line
2.26.3