mbox series

[v2,00/13] btrfs: some fixes and updates around handling errors for tree mod log operations

Message ID cover.1686219923.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: some fixes and updates around handling errors for tree mod log operations | expand

Message

Filipe Manana June 8, 2023, 10:27 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

This mostly helps avoid some unnecessary enomem failures when logging
tree mod log operations and replace some BUG_ON()'s when dealing with
such failures. There's also 2 bug fixes (the first two patches) and
some cleanups. More details on the changelogs.

V2: Add explicit error messages in patches 8/13 and 9/13.
    Add missing unlock and ref count drop of 'right' extent buffer to patch 12/13.
    Add missing extent buffer ref count drops for right and mid extent buffers in
    error paths of balance_level() to patch 13/13.
    Fix subject of patch 2/13 (removed duplicated word).
    Added Reviewed-by tags where appropriate.

Filipe Manana (13):
  btrfs: add missing error handling when logging operation while COWing extent buffer
  btrfs: fix extent buffer leak after tree mod log failure at split_node()
  btrfs: avoid tree mod log ENOMEM failures when we don't need to log
  btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block()
  btrfs: do not BUG_ON() on tree mod log failure at balance_level()
  btrfs: rename enospc label to out at balance_level()
  btrfs: avoid unnecessarily setting the fs to RO and error state at balance_level()
  btrfs: abort transaction at balance_level() when left child is missing
  btrfs: abort transaction at update_ref_for_cow() when ref count is zero
  btrfs: do not BUG_ON() on tree mod log failures at push_nodes_for_insert()
  btrfs: do not BUG_ON() on tree mod log failure at insert_new_root()
  btrfs: do not BUG_ON() on tree mod log failures at insert_ptr()
  btrfs: do not BUG_ON() on tree mod log failures at btrfs_del_ptr()

 fs/btrfs/ctree.c        | 221 +++++++++++++++++++++++++++++-----------
 fs/btrfs/ctree.h        |   4 +-
 fs/btrfs/tree-mod-log.c | 148 ++++++++++++++++++++-------
 3 files changed, 279 insertions(+), 94 deletions(-)

Comments

David Sterba June 9, 2023, 4:51 p.m. UTC | #1
On Thu, Jun 08, 2023 at 11:27:36AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> This mostly helps avoid some unnecessary enomem failures when logging
> tree mod log operations and replace some BUG_ON()'s when dealing with
> such failures. There's also 2 bug fixes (the first two patches) and
> some cleanups. More details on the changelogs.
> 
> V2: Add explicit error messages in patches 8/13 and 9/13.
>     Add missing unlock and ref count drop of 'right' extent buffer to patch 12/13.
>     Add missing extent buffer ref count drops for right and mid extent buffers in
>     error paths of balance_level() to patch 13/13.
>     Fix subject of patch 2/13 (removed duplicated word).
>     Added Reviewed-by tags where appropriate.
> 
> Filipe Manana (13):
>   btrfs: add missing error handling when logging operation while COWing extent buffer
>   btrfs: fix extent buffer leak after tree mod log failure at split_node()
>   btrfs: avoid tree mod log ENOMEM failures when we don't need to log
>   btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block()
>   btrfs: do not BUG_ON() on tree mod log failure at balance_level()
>   btrfs: rename enospc label to out at balance_level()
>   btrfs: avoid unnecessarily setting the fs to RO and error state at balance_level()
>   btrfs: abort transaction at balance_level() when left child is missing
>   btrfs: abort transaction at update_ref_for_cow() when ref count is zero
>   btrfs: do not BUG_ON() on tree mod log failures at push_nodes_for_insert()
>   btrfs: do not BUG_ON() on tree mod log failure at insert_new_root()
>   btrfs: do not BUG_ON() on tree mod log failures at insert_ptr()
>   btrfs: do not BUG_ON() on tree mod log failures at btrfs_del_ptr()

Added to misc-next, thanks.
David Sterba June 9, 2023, 5:20 p.m. UTC | #2
On Thu, Jun 08, 2023 at 11:27:36AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> This mostly helps avoid some unnecessary enomem failures when logging
> tree mod log operations and replace some BUG_ON()'s when dealing with
> such failures. There's also 2 bug fixes (the first two patches) and
> some cleanups. More details on the changelogs.

The net effect of this patchset (+ the split_item fix) is -12 BUG_ONs,
that's great. Lost of them have been there for a long time. There are
still a few more remaining in ctree.c, some of them look like assertions
but verifying the conditions besides assertions would be good too. That
can be decided case by case.