Skip to content

Rework fs error handling

Josef Bacik linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: always abort the transaction if we abort a trans handlefs/btrfs/ctree.c fs/btrfs/extent-tree.c fs/btrfs/super.c +2 more+1 -251 reply
2/3btrfs: add a btrfs_has_fs_error helperfs/btrfs/ctree.h fs/btrfs/disk-io.c fs/btrfs/extent_io.c +6 more+21 -192 replies
3/3btrfs: do not infinite loop in data reclaim if we abortedfs/btrfs/space-info.c+24 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Rework fs error handling

Hello,

This series brings together 3 patches I had sent separately, because they mostly depend on eachother. The first is

btrfs: always abort the transaction if we abort a trans handle

Which changes our behavior for trans handles that haven't modified any metadata. Our dependency chain can be complex, and thus we may rely on a particular async action happening and rely on the transaction actually aborting if it fails. Previously if nothing occurred we'd just let the transaction conitue, but this could put us in a bad state. We need to simply always abort the transaction for safety reasons.

That patch allows us to use the next patch

btrfs: add a btrfs_has_fs_error helper

Now that we can rely on FS_STATE_ERROR always being set if something is wrong, we can wrap that check in a helper and convert all the open coded checks for FS_STATE_ERROR and FS_STATE_ABORTED to the new helper.

And finally an actual fix

btrfs: do not infinite loop in data reclaim if we aborted

The async data path could infinite loop if we aborted because it only broke in the case of space_info->full, which would never happen if we weren't full and had aborted the transaction. This is fine stand alone, but I took advantage of the helpers here so I want to make sure the fix goes along with its dependencies. Thanks,

Josef

Josef Bacik (3):
btrfs: always abort the transaction if we abort a trans handle
btrfs: add a btrfs_has_fs_error helper
btrfs: do not infinite loop in data reclaim if we aborted

 fs/btrfs/ctree.c       |  5 +----
 fs/btrfs/ctree.h       |  5 +++++
 fs/btrfs/disk-io.c     |  8 +++-----
 fs/btrfs/extent-tree.c |  1 -
 fs/btrfs/extent_io.c   |  2 +-
 fs/btrfs/file.c        |  2 +-
 fs/btrfs/inode.c       |  6 +++---
 fs/btrfs/scrub.c       |  2 +-
 fs/btrfs/space-info.c  | 29 ++++++++++++++++++++++++-----
 fs/btrfs/super.c       | 13 +------------
 fs/btrfs/transaction.c | 19 +++++--------------
 fs/btrfs/transaction.h |  1 -
 fs/btrfs/tree-log.c    |  2 +-
 13 files changed, 46 insertions(+), 49 deletions(-)
Signature · 1 line
2.26.3