Skip to content

Error handling fixes

Josef Bacik linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7btrfs: use btrfs_handle_fs_error in btrfs_fill_superfs/btrfs/super.c+1 -01 reply
2/7btrfs: replace BUG_ON(level == 0) with ASSERT(level)fs/btrfs/ctree.c+1 -11 reply
3/7btrfs: handle errors from btrfs_read_node_slot in splitfs/btrfs/ctree.c+26 -270 replies
4/7btrfs: iput on orphan cleanup failurefs/btrfs/inode.c+4 -10 replies
5/7btrfs: drop root refs properly when orphan cleanup failsfs/btrfs/disk-io.c+2 -21 reply
6/7btrfs: handle errors in walk_down_tree properlyfs/btrfs/extent-tree.c+4 -40 replies
7/7btrfs: abort the transaction if we get an error during snapshot dropfs/btrfs/extent-tree.c+2 -00 replies

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchJohannes Thumshirn
1/7R-b
2/7R-b
3/7
4/7
5/7R-b
6/7
7/7

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

Read the v1 thread

Cover letter [PATCH 0/7] Error handling fixes

Hello,

For a short period of time our btrfs backport had 947a629988f1 ("btrfs: move tree block parentness check into validate_extent_buffer()") without the associated fix, which resulted in a lot of hilarity.

One of the things that popped was a WARN_ON(ret == 1) in __btrfs_free_extent where we didn't find the bytenr we were looking for. This was troubling, as it appeared that we were losing the EIO and returning 1 from btrfs_search_slot.

I rigged up my error injection stress test with btrfs_check_leaf/btrfs_check_node with balance (as this was the path that we saw the error). This of course uncovered a few other unrelated things, but eventually I reproduced what we saw in production. Thankfully it was not that we were eating the -EIO and returning 1 instead, however the actual problem is worse. We do not handle the errors properly in snapshot delete (which also gets used by reloation), and then we do not abort the transaction when we hit errors in this path, which leads to the file system being corrupted and eventually triggers the above WARN_ON().

With these fixes in place my stress testing was running overnight without tripping over any other leaks, corruptions, or panics. Previously I wasn't able to run for longer than a couple of minutes without falling over. Thanks,

Josef

Josef Bacik (7):
btrfs: use btrfs_handle_fs_error in btrfs_fill_super
btrfs: replace BUG_ON(level == 0) with ASSERT(level)
btrfs: handle errors from btrfs_read_node_slot in split
btrfs: iput on orphan cleanup failure
btrfs: drop root refs properly when orphan cleanup fails
btrfs: handle errors in walk_down_tree properly
btrfs: abort the transaction if we get an error during snapshot drop

 fs/btrfs/ctree.c       | 55 +++++++++++++++++++++---------------------
 fs/btrfs/disk-io.c     |  4 +--
 fs/btrfs/extent-tree.c | 10 +++++---
 fs/btrfs/inode.c       |  5 +++-
 fs/btrfs/super.c       |  1 +
 5 files changed, 40 insertions(+), 35 deletions(-)
Signature · 1 line
2.26.3