mbox series

[v2,0/2] btrfs: fix lost error value deleting root reference

Message ID cover.1661179270.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: fix lost error value deleting root reference | expand

Message

Filipe Manana Aug. 22, 2022, 2:47 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Fix a silent failure in case deleting a root reference fails when searching
for an item. Then make btrfs_del_root_ref() less likely to run into such
type of bug in the future. Details in the changelogs.

V2: Fix patch 2/2. If the BTRFS_ROOT_BACKREF_KEY item is not found, but
    the BTRFS_ROOT_REF_KEY is found, then before we would return -ENOENT
    and now we were returning 0 (unless an error happened when deleting
    the BTRFS_ROOT_REF_KEY item). Just return -ENOENT whenever one of
    the items is not found, all the callers abort the transaction if
    btrfs_del_root_ref() returns an error.

Filipe Manana (2):
  btrfs: fix silent failure when deleting root reference
  btrfs: simplify error handling at btrfs_del_root_ref()

 fs/btrfs/root-tree.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

David Sterba Aug. 22, 2022, 6:30 p.m. UTC | #1
On Mon, Aug 22, 2022 at 03:47:08PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Fix a silent failure in case deleting a root reference fails when searching
> for an item. Then make btrfs_del_root_ref() less likely to run into such
> type of bug in the future. Details in the changelogs.
> 
> V2: Fix patch 2/2. If the BTRFS_ROOT_BACKREF_KEY item is not found, but
>     the BTRFS_ROOT_REF_KEY is found, then before we would return -ENOENT
>     and now we were returning 0 (unless an error happened when deleting
>     the BTRFS_ROOT_REF_KEY item). Just return -ENOENT whenever one of
>     the items is not found, all the callers abort the transaction if
>     btrfs_del_root_ref() returns an error.
> 
> Filipe Manana (2):
>   btrfs: fix silent failure when deleting root reference
>   btrfs: simplify error handling at btrfs_del_root_ref()

Added to misc-next, thanks.